4 Replies Latest reply on Aug 3, 2007 7:30 PM by genman

    RMI per call overhead?

    caultonpos

      I tested a Stateless Session Bean using EJB 3.0, JBoss 4.2.0, Java 1.6. The server is RedHat linux and the bean has a method which does nothing but return an Integer.

      While connected to the internet I can ftp to the remote server at a rate of around 120KB/s so I have a reasonable connection.

      However using RMI over HTTP (pure RMI did not make it faster) I get a consistent time of around 500ms to execute that single method call - returning that one integer.

      It appears to be the method overhead - returning several large objects is only 100ms slower.

      Running that same method with the server on the same machine results in an overhead of 15ms per execution to return that integer.

      Is there something specifically that I should be caching to reduce the per call overhead?

        • 1. Re: RMI per call overhead?
          genman

          RMI is slow, hence the creation of asynchronous interfaces such as JMS.

          There may be certain instances you can cache, so subsequent calls can be done using the same objects.

          • 2. Re: RMI per call overhead?
            triathlon98

            Are you accessing the server using direct IP address?
            If so, try assuring that there is a dns mapping for the ip address.

            Joachim

            • 3. Re: RMI per call overhead?
              caultonpos

              Yes, direct IP. I found that caching everything to do with the bean lookup helped - got it down to 250ms so that was an improvement.

              I have all the reference data cached with infrequent checks. Activity data I just check if it has changed. I was able to get the application reasonable over the internet. If I could batch a number of calls together that would certainly help in some cases though there are not that many opportunities.

              Managing caches to prevent stale data is tough but I think I can do it.

              It still doesnt make sense to me that there is that much overhead on a single RMI call over the internet. Does one Boolean call with no parameters pass a lot of additional content? But regardless if I can ftp at 100's of KB per second...

              There must be something still to be tuned there, doesn't quite add up.

              • 4. Re: RMI per call overhead?
                genman

                Bandwidth is not the same as latency. Run "tcpdump" or turn on server.log debugging to see what's actually taking time. I'm guessing there's a lot of ping-ponging going on.