3 Replies Latest reply on Aug 19, 2009 6:11 AM by heineson

    Can't get JBoss to use custom loadbalancer

    heineson

      Hello,

      I need to write a custom loadbalancer or interceptor to route EJB requests to different servers in the cluster. The problem is I can't get JBoss to use my LB. Anyone have an idea? I am thinking maybe jboss can't find my class and therefore doesn't use it. If this is the case, where should I put the LB class?

      section of jboss.xml for the clustered (stateless) bean:

      <cluster-config>
       <partition-name>MyPartition</partition-name>
       <bean-load-balance-policy>
       com.acme.MyCustomBalancer
       </bean-load-balance-policy>
       <home-load-balance-policy>
       com.acme.MyCustomBalancer
       </home-load-balance-policy>
       </cluster-config>
      


      And the simple LB I try to use for testing
      public class MyCustomBalancer extends FirstAvailable {
      
       @Override
       public Object chooseTarget(FamilyClusterInfo clusterFamily, Invocation routingDecision) {
       System.out.println("AAAAAAAAAAA");
       //List targets = clusterFamily.getTargets();
       return super.chooseTarget(clusterFamily, routingDecision);
       }
      
      }


        • 1. Re: Can't get JBoss to use custom loadbalancer

          Hi,

          did u get solution to this? Even i am facing the same problem. I have clustered stateless beans [EJB 3.0] in my application. In my clustered deployment, all calls to the beans originated within the server VM are handled by the beans from the same server node only although there are beans avaialable freely in other node and the load balance policy is round robin. Please let me know how u resolved ur problem.

          thanks,
          Kedar

          • 2. Re: Can't get JBoss to use custom loadbalancer
            f_marchioni

            With JBoss 5 the load balance policy class are into:

            jboss-5.0.0.GA\common\lib\jbossha.jar
            jboss-5.0.0.GA\client\jboss-ha-legacy-client.jar

            With JBoss 4:

            jboss-4.2.2.GA\client\jbossha-client.jar:
            jboss-4.2.2.GA\server\all\lib\jbossha.jar:

            try adding your custom load balancing policy in both client and server .jars.
            Let me know if it worked.
            bye
            francesco

            • 3. Re: Can't get JBoss to use custom loadbalancer
              heineson

               

              "kedarpjoshi" wrote:
              Hi,

              did u get solution to this? Even i am facing the same problem. I have clustered stateless beans [EJB 3.0] in my application. In my clustered deployment, all calls to the beans originated within the server VM are handled by the beans from the same server node only although there are beans avaialable freely in other node and the load balance policy is round robin. Please let me know how u resolved ur problem.

              thanks,
              Kedar


              My problem was (as usual) a simple silly error from my side. Just forgot to put the classes in the client jars, only in the server application...

              /Jonas