8 Replies Latest reply on Nov 4, 2008 7:29 AM by rafaelcba

    How does JBoss handle Local and Remote interfaces

    mrfarhankhan

      Hi,

      How does JBoss4.2.2.GA handle EJB3 @Local and @Remote interfaces. If i define all the interfaces to be remote, but they exist in the same JVM, does JBoss treat them as local ?

      Is there any performance gain if i change from @Remote to @Local ?

      Thanks in advance
      Farhan !

        • 1. Re: How does JBoss handle Local and Remote interfaces
          jaikiran

          For remote interfaces the params and return values are serialized/deserialized. Whereas calls through local interfaces don't involve these steps. So if you are using the beans within the same JVM, then its better to use local interfaces.

          • 2. Re: How does JBoss handle Local and Remote interfaces
            alrubinger

            Note that if invoking upon a Remote interface within the same JVM, pass-by-value semantics apply to fit spec (as Jaikiran noted) but the network stack is bypassed (for efficiency).

            S,
            ALR

            • 3. Re: How does JBoss handle Local and Remote interfaces
              mrfarhankhan

              Thanks for the reply. I'm using JSF, EJB3, JBoss4.2.2.GA. I have several stateless EJB deployed on JBOSS, on the same machine.

              I have updated now and using the local interfaces instead of the remote interfaces. Also, I have done JBoss tunning and slimming as mentioned in this link
              http://www.jboss.org/community/docs/DOC-10181

              But there is no significant gain in performance. What else can I do to achieve optimum performance ?

              Thanks in advance.
              Farhan!

              • 4. Re: How does JBoss handle Local and Remote interfaces
                peterj

                The first step in performance tuning is gathering performance data so that you can identify the bottleneck (that is, where things are running too slowly). With the bottleneck identified, you can fix that. Without knowing where your bottleneck is, you will not be able to get any performance improvement.

                • 5. Re: How does JBoss handle Local and Remote interfaces
                  mrfarhankhan

                  Would you suggest any profiler thats best for this purpose ? Secondly, I'v noticed that the application renders slow on IE as compared to FireFox browser. Any tips ?

                  Farhan !

                  • 6. Re: How does JBoss handle Local and Remote interfaces
                    edek234

                    Actually I'm not an expert, if there is abetter way of doing this, please let me know.

                    I would write a filter, recoding execution times in ThreadLocal, and dump it into logs in a Servlet fillter (unless you are trying to profile WebServices).

                    Browsers: there is a lot going on in the browser, like javascript. I wouldn't worry about it too much, unless you should for some reason. This does not affect the server. I would test the server with JMeter, to see how many clients it can handle.

                    • 7. Re: How does JBoss handle Local and Remote interfaces
                      edek234

                      I meant an interceptor, not a filter. The EJB interceptor.

                      • 8. Re: How does JBoss handle Local and Remote interfaces
                        rafaelcba

                        Hi All!

                        Is possible force Call-By-Value on local invocations made cross EARs with isolated class loaders deployed on same JBoss?

                        I have that scenario:

                        Two EARs deployed on same JBoss AS:
                        App1.ear
                        - META-INF (descriptors)
                        - lib/lib.jar (ClassA.class)
                        - EJB.jar (MyBean1)

                        App2.ear
                        - META-INF (descriptors)
                        - lib/lib.jar (ClassA.class)
                        - EJB.jar (MyBean2)

                        MyBean 1 make a local invocation to MyBean2 passing a intance of ClassA.class. When MyBean2 handle this invocation it throw a ClassCastException... Because ClassA passed by MyBean1 has other ClassLoader...

                        I read at JBossWiki [1] that is possible force CallByValue on JBoss invocatios:

                         <!-- EAR deployer, remove if you are not using Web layers -->
                         <mbean code="org.jboss.deployment.EARDeployer" name="jboss.j2ee:service=EARDeployer">
                         <!-- Isolate all ears in their own classloader space -->
                         <attribute name="Isolated">true</attribute>
                         <!-- Enforce call by value to all remote interfaces -->
                         <attribute name="CallByValue">true</attribute>
                         </mbean>
                        


                        But don't work for local invocations.

                        When this conf (true) make cense on JBoss???

                        [1] https://www.jboss.org/community/docs/DOC-9288