2 Replies Latest reply on Dec 9, 2002 9:46 AM by daveespo

    RMI method invocation very slow

      Hello,

      I have an interesting problem. The short version is: when I try to invoke a method on my remote object from inside of my servlet (running under JBOSS3.0.4/Tomcat4.1), the method takes _FOREVER_ (800ms). However, when I invoke that same method from a standalone test application, it is zippy (less than 20ms).

      Platform:
      "Server" - an RMI server running under JBOSS3.0.4; the RMI server object has registered itself with the JBOSS naming directory (JNDI) ... This is a seperate machine (let's call it Server A)

      "ClientA" - a plain HTTP servlet running under JBOSS3.0.4/Tomcat4.1; let's call this Server B

      "ClientB" - a plain Java application running from the command prompt; (also running on Server B)

      When I packet sniff the call from ClientA to the RMI server, the size of the packet that gets sent is in the 40Kilobyte!! range ... The data inside this packet appears to be a lot of the classpath stuff ... the JBOSS deploy directories; the names of the JARs that are currently deployed (database driver JARs, external library JARs, etc...)

      When I packet sniff the call from ClientB to the RMI server, the size of the packet is normal; just the serialized objects that are being passed to the server as the method arguments ... The total size of the method arrguments are like 10 or 15 bytes ... (a few longs, a few ints, a couple of short Strings)

      So what's going on inside of the Servlet? Why is JBOSS/Tomcat smacking all of this stuff onto the call? I have tried using both remote class loading (for my Stub) as well as packaging it on the client side ...

      Here's a snippet of the 40k worth of stuff that's being sent from the client to the server:

      /deploy/tomcat-4.1.x/server/lib/commons-logging.jar/55.commons-logging.jar file:/C:/jdk1.3/lib/tools.jar file:/C:/jboss-3.0.4-tomcat/server/default/tmp/deploy/server/default/lib/jts.jar/19.jts.jar file:/C:/jboss-3.0.4-tomcat/server/default/tmp/deploy/server/default/lib/scheduler-plugin-example.jar/7.scheduler-plugin-example.jar file:/C:/jboss-3.0.4-tomcat/server/default/tmp/deploy/server/default/deploy/mail-service.xml/47.mail-service.xml file:/C:/jdk1.3/jre/lib/ext/US_export_policy.jar file:/C:/jboss-3.0.4-tomcat/server/default/tmp/deploy/server/default/deploy/counter-service.xml/41.counter-service.xml file:/C:/jboss-3.0.4-tomcat/tomcat-4.1.x/work/MainEngine/localhost/testjms/WEB-INF/classes/ file:/C:/jdk1.3/jre/lib/ext/jnet.jar file:/C:/jboss-3.0.4-tomcat/server/default/tmp/deploy/tomcat-4.1.x/common/lib/jasper-compiler.jar/69.jasper-compiler.jar file:/C:/jboss-3.0.4-tomcat/server/default/tmp/deploy/server/default/lib/jboss.jar/32.jboss.jar file:/C:/jboss-3.0.4-tomcat/server/default/tmp/deploy/tomcat-4.1.x/server/lib/commons-digester.jar/83.commons-digester.jar file:/C:/jboss-3.0.4-tomcat/bin/ file:/C:/jboss-3.0.4-tomcat/server/default/tmp/deploy/server/default/lib/jbosssx.jar/8.jbosssx.jar file:/C:/jboss-3.0.4-tomcat/server/default/tmp/deploy/tomcat-4.1.x/server/lib/servlets-default.jar

      Thanks in advance,
      Dave

        • 1. Re: RMI method invocation very slow

          Your problem is RMI class annotation.
          RMI is invoking getURLs() on the classloader
          and passing this with the request.

          JBoss has some "performance enhancements" that allows
          us to remove the url annotation,
          but obviously this is not done by Tomcat classloader

          One possible fix would be to perform the request
          using an object loaded using a JBoss classloader,
          e.g. an MBean, ejb or just a utility class outside
          the web application.
          RMI ignores the application classloader, it starts
          from the classloader that loaded the class.

          FYI: There are some futher performance improvements
          in JBoss3.0.5RC1 available from CVS.

          One removes {jboss.dist}/lib annotation.
          The other fixes a "performance bug" introduced in
          jboss3.0.4 jndi lookup(), reducing the data sent by a
          factor of 10.

          Regards,
          Adrian

          • 2. Re: RMI method invocation very slow

            Adrian,

            Thank you for your reply.

            I am somewhat of a novice at RMI ... so this is the first I've heard of class annotation ... You are correct though, when inside my servlet, if I do RMIClassLoader.getClassAnnotation(<the class that i'm passing as an arg to my RMI method), i get the mammoth classpath that I was describing ...

            Creating an MBean outside of my servlet seems like a rather heavy workaround ... My question is this, really: why would the getClassAnnotation return classpaths that are only on the local machine, that is, ones that begin "file://" ... It seems kind of silly since it's unlikely that the server would be able to access those URLs ... It seems like a lot of overhead to send to the server ...

            From my brief scan of the tomcat lists, I see that this issue has been raised there too ... How is JBOSS's solution (that you mention in your post) implemented? Does it ignore local (file://) URLs when creating it's class annotation?

            Thanks again,
            Dave