Hama
  1. Hama
  2. HAMA-461

Extract a Message Service from BSPPeer

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.3.0
    • Fix Version/s: 0.4.0
    • Component/s: None
    • Labels:
      None

      Description

      There's a problem, that we have more synchronized Collections than we need. localQueueForNextIteration (or similar name) is the only one which needs to be thread safe. At least only the put method could be synchronized, because reads does not need to be threadsafe.

      So we should refactor our messaging system from the peer itself.
      A hint in architecture could give us HAMA-457.

      We have to add a factory which let's the user choice their protocol.

      1. HAMA-461_v1.patch
        31 kB
        Thomas Jungblut
      2. HAMA-461_v2.patch
        31 kB
        Thomas Jungblut

        Activity

        Hide
        Hudson added a comment -

        Integrated in Hama-Nightly #346 (See https://builds.apache.org/job/Hama-Nightly/346/)
        HAMA-461 extract message service

        tjungblut :
        Files :

        • /incubator/hama/trunk/CHANGES.txt
        • /incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPPeer.java
        • /incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPPeerImpl.java
        • /incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/LocalBSPRunner.java
        • /incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/message
        • /incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/message/HadoopMessageManager.java
        • /incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/message/HadoopMessageManagerImpl.java
        • /incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/message/MessageManager.java
        • /incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/message/MessageManagerFactory.java
        • /incubator/hama/trunk/core/src/test/java/org/apache/hama/bsp/message
        • /incubator/hama/trunk/core/src/test/java/org/apache/hama/bsp/message/TestHadoopMessageManager.java
        Show
        Hudson added a comment - Integrated in Hama-Nightly #346 (See https://builds.apache.org/job/Hama-Nightly/346/ ) HAMA-461 extract message service tjungblut : Files : /incubator/hama/trunk/CHANGES.txt /incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPPeer.java /incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPPeerImpl.java /incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/LocalBSPRunner.java /incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/message /incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/message/HadoopMessageManager.java /incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/message/HadoopMessageManagerImpl.java /incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/message/MessageManager.java /incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/message/MessageManagerFactory.java /incubator/hama/trunk/core/src/test/java/org/apache/hama/bsp/message /incubator/hama/trunk/core/src/test/java/org/apache/hama/bsp/message/TestHadoopMessageManager.java
        Hide
        Edward J. Yoon added a comment -

        Even though exception occurs, job is always success. We have to fix.

        Show
        Edward J. Yoon added a comment - Even though exception occurs, job is always success. We have to fix.
        Hide
        Thomas Jungblut added a comment -

        Committed. Thanks for your fast review Edward!

        Show
        Thomas Jungblut added a comment - Committed. Thanks for your fast review Edward!
        Hide
        Edward J. Yoon added a comment -

        Patch looks great! +1

        Show
        Edward J. Yoon added a comment - Patch looks great! +1
        Hide
        Thomas Jungblut added a comment -

        Should be fixed now, I forgot to call init and therefore the configuration was null.

        Show
        Thomas Jungblut added a comment - Should be fixed now, I forgot to call init and therefore the configuration was null.
        Hide
        Thomas Jungblut added a comment -

        I take a look at it. Thanks for testing.

        Show
        Thomas Jungblut added a comment - I take a look at it. Thanks for testing.
        Hide
        Edward J. Yoon added a comment -

        Awesome.

        BTW, I received below errors.

        
        java.lang.NullPointerException
                at org.apache.hadoop.net.NetUtils.getDefaultSocketFactory(NetUtils.java:89)
                at org.apache.hadoop.ipc.RPC.getProxy(RPC.java:383)
                at org.apache.hama.bsp.message.HadoopMessageManagerImpl.getBSPPeerConnection(HadoopMessageManagerImpl.java:133)
                at org.apache.hama.bsp.message.HadoopMessageManagerImpl.transfer(HadoopMessageManagerImpl.java:145)
                at org.apache.hama.bsp.BSPPeerImpl.sync(BSPPeerImpl.java:244)
                at org.apache.hama.examples.PiEstimator$MyEstimator.bsp(PiEstimator.java:72)
                at org.apache.hama.bsp.BSPTask.runBSP(BSPTask.java:88)
                at org.apache.hama.bsp.BSPTask.run(BSPTask.java:66)
                at org.apache.hama.bsp.GroomServer$BSPPeerChild.main(GroomServer.java:907)
        11/11/07 10:26:47 INFO zookeeper.ZooKeeper: Session: 0x1337ba1e64d001d closed
        
        Show
        Edward J. Yoon added a comment - Awesome. BTW, I received below errors. java.lang.NullPointerException at org.apache.hadoop.net.NetUtils.getDefaultSocketFactory(NetUtils.java:89) at org.apache.hadoop.ipc.RPC.getProxy(RPC.java:383) at org.apache.hama.bsp.message.HadoopMessageManagerImpl.getBSPPeerConnection(HadoopMessageManagerImpl.java:133) at org.apache.hama.bsp.message.HadoopMessageManagerImpl.transfer(HadoopMessageManagerImpl.java:145) at org.apache.hama.bsp.BSPPeerImpl.sync(BSPPeerImpl.java:244) at org.apache.hama.examples.PiEstimator$MyEstimator.bsp(PiEstimator.java:72) at org.apache.hama.bsp.BSPTask.runBSP(BSPTask.java:88) at org.apache.hama.bsp.BSPTask.run(BSPTask.java:66) at org.apache.hama.bsp.GroomServer$BSPPeerChild.main(GroomServer.java:907) 11/11/07 10:26:47 INFO zookeeper.ZooKeeper: Session: 0x1337ba1e64d001d closed
        Hide
        Thomas Jungblut added a comment -

        Lots of refactorings. I'm still not sure if this is the final design.
        But it is a way to go for our current RPC implementation.

        I thought of extending this and offer a asynchronous messaging, but I'll do this on github.

        I also revised the synchronization, only the queue for the next iteration which is used by the RPC server is synchronized now. So this should be a slightly bit faster now.

        BSPPeer is now not a RPC server anymore.
        I'm not sure how we can implement other protocols on top of it, but if we have the need, we can change this.

        [INFO] Apache Hama parent POM ............................ SUCCESS [1.652s]
        [INFO] Apache Hama Core .................................. SUCCESS [57.303s]
        [INFO] Apache Hama Graph Package ......................... SUCCESS [0.771s]
        [INFO] Apache Hama Examples .............................. SUCCESS [11.148s]
        
        

        I hope the peer is now less complex.

        Show
        Thomas Jungblut added a comment - Lots of refactorings. I'm still not sure if this is the final design. But it is a way to go for our current RPC implementation. I thought of extending this and offer a asynchronous messaging, but I'll do this on github. I also revised the synchronization, only the queue for the next iteration which is used by the RPC server is synchronized now. So this should be a slightly bit faster now. BSPPeer is now not a RPC server anymore. I'm not sure how we can implement other protocols on top of it, but if we have the need, we can change this. [INFO] Apache Hama parent POM ............................ SUCCESS [1.652s] [INFO] Apache Hama Core .................................. SUCCESS [57.303s] [INFO] Apache Hama Graph Package ......................... SUCCESS [0.771s] [INFO] Apache Hama Examples .............................. SUCCESS [11.148s] I hope the peer is now less complex.
        Hide
        Thomas Jungblut added a comment -
        Show
        Thomas Jungblut added a comment - Look at what I have seen: https://issues.apache.org/jira/browse/HADOOP-7773
        Hide
        Thomas Jungblut added a comment -

        This could have multiple problems.

        Hadoop's Writable interface is hacked in all of our classes.
        So it would be quite hard for other protocols to deal with this.

        Of course you can always open a ByteArrayOutputStream and set it as the DataOutput and get the real byte codes. But this sucks in performance.
        Sadly there is no other way, but refactoring the messages.
        I won't do that, because I changed it in the last release and it is currently quite useable. But I cannot remember why I used a marker interface "Messagable" and made an abstract class for a BSPMessage.

        Instead it should be a MessagableWritable interface, and other services could then make a MessagableOtherFancyStuff interface. I hope you get the gist.

        So within this task, I just refactor out the messaging we currently have in our BSPPeerImpl.

        The overall design has to be revisted, though. I would suggest the next release.

        Show
        Thomas Jungblut added a comment - This could have multiple problems. Hadoop's Writable interface is hacked in all of our classes. So it would be quite hard for other protocols to deal with this. Of course you can always open a ByteArrayOutputStream and set it as the DataOutput and get the real byte codes. But this sucks in performance. Sadly there is no other way, but refactoring the messages. I won't do that, because I changed it in the last release and it is currently quite useable. But I cannot remember why I used a marker interface "Messagable" and made an abstract class for a BSPMessage. Instead it should be a MessagableWritable interface, and other services could then make a MessagableOtherFancyStuff interface. I hope you get the gist. So within this task, I just refactor out the messaging we currently have in our BSPPeerImpl. The overall design has to be revisted, though. I would suggest the next release.

          People

          • Assignee:
            Thomas Jungblut
            Reporter:
            Thomas Jungblut
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development