11 Replies Latest reply on Mar 11, 2004 4:12 AM by Wolf-Christian Herold

    Load-Balancing SLSBs on 3.2.3

    timfraser Newbie

      Apologies in advance, as I suspect you've been through all this before.

      I'm having problems balancing a SLSB across two JBOSS cluster nodes, with calls from a remote client.

      I've trawled through the forum and can't work out whether it's possible to cache remote and/or home SLSB interfaces and still expect load-balancing across nodes. I've tried all combinations and only get balancing when I re-create the home and remote interfaces on every business call to the SLSB.

      The bean ejb-jar.xml has it's cluster-config xml set to true, and the home and bean balancing policies set to org.jobss.ha.framework.interfaces.RoundRobin (also tried removing the policy entries and going with defaults - also tried setting to FirstAvailable).

      The remote client uses HA-JNDI (autodiscovery is on) and jboss INFO logs indicate that multicast stuff is working (i see notifyKeyListeners etc). Also checked multicast is okay between the Solaris boxes I'm running the clustered nodes on.

      Have I made a basic mistake in assuming that the home/remote interfaces of a SLSB can be cached and the smart stub still provide round-robin behaviour?

      Any help would be greatly appreciated!

      Thanks,

      Tim













        • 1. Re: Load-Balancing SLSBs on 3.2.3
          glyn_walters Newbie

          It works for me. I've got the home load balance policy and the bean load balance policy set to RoundRobin and I cache the home reference. The only difference is that I specify Context.PROVIDER_URL for the HA-JNDI servers rather than using autodiscovery. The SLSB load balances round robin perfectly.

          Perhaps its worth trying PROVIDER_URL for your HA-JNDI servers to ensure your SLSB isn't just binding to the local JNDI?

          • 2. Re: Load-Balancing SLSBs on 3.2.3
            timfraser Newbie

            Glynn

            I've tried the following:

            props.put(Context.PROVIDER_URL, "10.129.133.141:1100,10.129.133.143:1100");

            (ip's of my two jboss nodes) but still no luck. The mbean interface on the DistributedReplicantManager displays

            HAJNDI
            10.129.133.141:1099
            10.129.133.143:1099


            DCacheBridge-DefaultJGBridge

            10.129.133.141:1099
            10.129.133.143:1099

            So i guess that indicates that the nodes are bound into the HAJNDI.

            Know of anything specific in the ejb.jar.xml that can cause problems - mine is standard for the SLSB. Just contains


            BeanTest( Stateless )
            <display-name>BeanTest</display-name>
            <ejb-name>BeanTest</ejb-name>
            True
            <cluster-config>
            <partition-name>DefaultPartition</partition-name>
            <home-load-balance-policy>org.jboss.ha.framework.interfaces.RoundRobin</home-load-balance-policy>
            <bean-load-balance-policy>org.jboss.ha.framework.interfaces.RoundRobin</bean-load-balance-policy>
            </cluster-config>
            TestEJBHome
            TestEJBRemote
            <ejb-class>TestEJB</ejb-class>
            <session-type>Stateless</session-type>
            <transaction-type>Container</transaction-type>



            Annoying because I can't see anything obviously wrong!


            • 3. Re: Load-Balancing SLSBs on 3.2.3
              timfraser Newbie

              xml not pasted correctly in last post. Had to remove the open/close brackets as wasn't viewing properly. Not as readable - sorry!

              session
              description BeanTest( Stateless ) description
              display-name BeanTest display-name
              ejb-name BeanTest ejb-name
              clustered True clustered
              cluster-config

              partition-name DefaultPartition partition-name
              home-load-balance-policy org.jboss.ha.framework.interfaces.RoundRobin home-load-balance-policy

              bean-load-balance-policy
              org.jboss.ha.framework.interfaces.RoundRobin bean-load-balance- policy

              cluster-config
              home TestEJBHome home
              remote TestEJBRemote remote
              ejb-class TestEJB ejb-class
              session-type Stateless session-type
              transaction-type Container transaction-type
              session




              Still, point is that it seems correct.




              • 4. Re: Load-Balancing SLSBs on 3.2.3
                glyn_walters Newbie

                Tim

                Here are my configs:

                from jboss.xml

                 <session>
                 <ejb-name>BBClientSessionEJB</ejb-name>
                 <jndi-name>BBClientSessionHomeRemote</jndi-name>
                 <ejb-ref>
                 <ejb-ref-name>ejb/BBClientHomeRO</ejb-ref-name>
                 <jndi-name>BBClientHomeRO</jndi-name>
                 </ejb-ref>
                 <ejb-ref>
                 <ejb-ref-name>ejb/BBClientHomeRW</ejb-ref-name>
                 <jndi-name>BBClientHomeRW</jndi-name>
                 </ejb-ref>
                 <clustered>True</clustered>
                 <cluster-config>
                 <partition-name>DefaultPartition</partition-name>
                 <home-load-balance-policy>
                 org.jboss.ha.framework.interfaces.RoundRobin
                 </home-load-balance-policy>
                 <bean-load-balance-policy>
                 org.jboss.ha.framework.interfaces.RoundRobin
                 </bean-load-balance-policy>
                 </cluster-config>
                 </session>
                

                from ejb-jar.xml
                 <session>
                 <ejb-name>BBClientSessionEJB</ejb-name>
                 <home>com.brokerbox.bbserver.server.BBClientSessionHomeRemote</home>
                 <remote>com.brokerbox.bbserver.server.BBClientSessionRemote</remote>
                 <ejb-class>com.brokerbox.bbserver.server.BBClientSessionBean</ejb-class>
                 <session-type>Stateless</session-type>
                 <transaction-type>Container</transaction-type>
                 <ejb-ref>
                 <ejb-ref-name>ejb/BBClientHomeRO</ejb-ref-name>
                 <ejb-ref-type>Entity</ejb-ref-type>
                 <home>com.brokerbox.bbserver.server.BBClientHomeRemote</home>
                 <remote>com.brokerbox.bbserver.server.BBClientRemote</remote>
                 </ejb-ref>
                 <ejb-ref>
                 <ejb-ref-name>ejb/BBClientHomeRW</ejb-ref-name>
                 <ejb-ref-type>Entity</ejb-ref-type>
                 <home>com.brokerbox.bbserver.server.BBClientHomeRemote</home>
                 <remote>com.brokerbox.bbserver.server.BBClientRemote</remote>
                 </ejb-ref>
                 <security-identity><use-caller-identity/></security-identity>
                 </session>
                 <session>
                


                I cache the home reference then just get a remote reference from the cached clientSessionHome like this:

                BBClientSessionRemote clientSession = clientSessionHome.create();

                I can't see anything wrong in your config though. Does the remote reference always get created in the jvm your client is running in?


                • 5. Re: Load-Balancing SLSBs on 3.2.3
                  glyn_walters Newbie

                  The other question is what version are you running? Mine is 3.2.3.

                  • 6. Re: Load-Balancing SLSBs on 3.2.3
                    glyn_walters Newbie

                    The answer of course being in the subject :)

                    • 7. Re: Load-Balancing SLSBs on 3.2.3
                      timfraser Newbie

                      Glyn

                      Problem solved. I removed the following assembly descriptor from my ejb declaration:

                      <container-transaction>
                      <method>
                      <ejb-name>TestEJB</ejb-name>
                      <method-name>*</method-name>
                      </method >
                      <trans-attribute>NotSupported</trans-attribute>
                      </container-transaction>

                      seems to have been causing the problems, though not entirely sure why... Any insight would be welcomed!

                      Can now load balance with cached home/remote. Fantastic.

                      Thanks for your help on this. Much appreciated.

                      Tim


                      • 8. Re: Load-Balancing SLSBs on 3.2.3
                        glyn_walters Newbie

                        There are some threads on this. Transaction must be Required, RequiresNew or Mandatory. See here http://www.jboss.org/index.html?module=bb&op=viewtopic&t=45327.

                        • 10. Re: Load-Balancing SLSBs on 3.2.3
                          Hendrik Sticher Newbie

                          I have the same question. I am also trying to load-balance a SLSB in RoundRobin fashion, but get something different when clustering on three nodes(70%, 20%, 10%).

                          The Initial Context gets created by

                          jndiProperties = new Hashtable();
                          jndiProperties.put(Context.PROVIDER_URL, providerUrl);
                          jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
                          jndiProperties.put(Context.URL_PKG_PREFIXES, "jboss:naming:org.jnp.interfaces");

                          initialContext = new InitialContext(jndiProperties);

                          providerUrl is : "appserver1:1100, apperserver2:1100, appserver3:1100"


                          I cached the RemoteHome and created the Remote on every request.
                          ->did not work for me as expected

                          Creating RemoteHome and Remote on every Request.
                          -> didn't work

                          BTW: The jboss.xml and ejb-jar.xml is configured correctly, <trans-attribute> is set to "Required"


                          Maybe some hinst on how to Debug things? Some code snippet or hint about
                          how to apply caching or not would also be nice. I am using jboss-3.2.3 and
                          believe that something is wrong in the way i am using this feature.


                          Best regards


                          Hendrik











                          • 11. Re: Load-Balancing SLSBs on 3.2.3
                            Wolf-Christian Herold Newbie

                            Hi
                            I also use clustered SLSB in a cluster.
                            My Clients are two Tomcat servers.
                            I wrote some client classes for caching Home an remote Interfaces.
                            I use the autodiscovery feature to lookup for nodes using UDP.
                            So in the client config I left the Context.PROVIDER_URL empty.
                            When testing I recognized, that caching of the Bean is necessary to loadbalance between the nodes. If I recreate the the Beans Remote each call, the calls are not balanced between the nodes (as far as I understood the list of the nodes is always the same and the first node will be taken from list each time).
                            This works fine.

                            My Problem is:
                            When restarting JBoss on all running nodes (so the references in the client get stale) my client classes recognizes this error and try to reload the home and the remote Proxy.
                            At this Point in a lot of cases (not always) the client can't get any home interface, even after 10 reties and after a some seconds.
                            I always get a NamingException with Message : null.
                            Some times I got also a NoSuchElementException.

                            The only thing to be able to reconnect to JBoss is to restart Tomcat (or if I copy the jnp-client.jar and jnet.jar to context to restart the context.

                            So it seems to me some informations are stored in any class in the classes in these jars.

                            Does anybody has any idea why this hapen an how to solve it?