8 Replies Latest reply on May 26, 2003 9:03 AM by slaboure

    Clustering Doc 3.2 Statement Accurate?

    toddmcf2002

      On Page 41 it says "the code in Listing 5-5 that continuously re-creates remote proxies for each invocation will correctly load-balance calls with JBoss 3-2 (and upper)."

      Is this true? I cannot get EJB to load balance from a remote client *unless* I cache the Bean reference between calls. Otherwise it simply pins to the first node it hits.

      This is a major problem - if JBoss gets recycled the EJB reference with throw a "Service Unnavailable" exception. I don't see any clean (generic) way to test the EJB reference without actually making a remote call.

        • 1. Re: Clustering Doc 3.2 Statement Accurate?
          toddmcf2002

          Can anyone help with this?

          Thanks,
          - Todd

          • 2. Re: Clustering Doc 3.2 Statement Accurate?
            slaboure

            Can you restate your question? You seem to have two problems (LB and service unavailable).

            As for the first, yes, it is implemented this way.

            Cheers,


            sacha

            • 3. Re: Clustering Doc 3.2 Statement Accurate?
              toddmcf2002

              >> Please restate...

              Load balancing will only work if I cache the EJB reference between calls. For JSP, this means putting the reference in the HttpSession.

              I have to cache the EJB reference itself, not just the Home interface.

              My JBoss.xml appears to be set up correctly, since Load Balancing does work if I cache the stub.

              As far as my "Service Unnavailable" comment, I brought that up as a negative of caching the EJB - if someone bounces the JBoss server the stub is invalid.

              I've attached my JBoss.xml.


              Thanks for any help,
              - Todd

              • 4. Re: Clustering Doc 3.2 Statement Accurate?
                darranl

                I am running with JBoss 3.2.1 using a stand alone application that just caches the home interfaces and I am having no problems with load balancing.

                Is your web application being hosted by JBoss?

                Is their any chance that you are getting a reference to your home interface from the local jndi instead of the HA-JNDI?

                • 5. Re: Clustering Doc 3.2 Statement Accurate?
                  slaboure

                  Are you *sure* your bean is clustered?

                  • 6. Re: Clustering Doc 3.2 Statement Accurate?
                    slaboure

                    Ok, I've just tried with a SLSB on JBoss 3.2.1 with your exact jboss.xml configuratino and it works, there is no need to cache the proxy to load-balance calls.

                    Can you check your environnement? You seem to have the old 3.0 behaviour.

                    Cheers,


                    sacha

                    • 7. Re: Clustering Doc 3.2 Statement Accurate?
                      toddmcf2002

                      I think I found it. Everything was set up correctly except I had a literal listing of server HA-JNDI nodes on the InitialContext.

                      NOTE: My client lives on one of the JBoss nodes. I was using:

                      myprops.put(Context.PROVIDER_URL, "machine1:1100,machine2:1100");

                      and I should have had :
                      myprops.put(Context.PROVIDER_URL, "localhost:1100")

                      I honestly thought I was using the second example.

                      The reason I found it was because I took down machine1 and noticed a lag on EJB calls when I was not caching stubs. It must have been trying to contact the first list member!

                      Sacha, does this sound like the right explaination for what I'm seeing? Everything works as advertised now.

                      I appreciate your help.

                      - Todd

                      • 8. Re: Clustering Doc 3.2 Statement Accurate?
                        slaboure

                        what is the difference between machine1, machine2 and localhost? Where are the servers? It should have worked, strange.