3 Replies Latest reply on May 4, 2014 4:51 PM by wdfink

    Load-balancing EJB calls from an EJB client

    dejanm

      I'm using a JBoss cluster with a number of EJB components deployed on it. I've noticed the following:

      • If I perform a JNDI lookup from an external client, the load-balancing process works as expected (i.e. a random cluster node is selected and the EJB is executed there)
      • If the client is one of the EJBs (i.e. one EJB invokes another), the target EJB is always executed on the same machine as the caller

       

      Is it possible to have the load-balancing feature in the second scenario as well? Both the external client and the calling EJB use remote interfaces only (the code is practically the same). None of the EJBs is marked with @LocalBean.

       

      I'm using asynchronous EJB invocation. If I employ JMS instead and call the target from a message-driven bean, I get the desired behavior, but the performance deteriorates.

       

      Please let me know if you need any additional information.

        • 1. Re: Load-balancing EJB calls from an EJB client
          jaikiran

          Hi Dejan, take a look at this post which explains the behaviour and how you can configure it https://community.jboss.org/message/758251#758251

          1 of 1 people found this helpful
          • 2. Re: Re: Load-balancing EJB calls from an EJB client
            dejanm

            Thank you for the prompt reply. I tried using the jboss-ejb-client.xml file, but my configuration was ignored - the provided object was never called. Then I replaced LocalEJBReceiverPreferringDeploymentNodeSelector with my own implementation and noticed that each node was aware only of itself. That is, the eligibleNodes arrays always contains exactly 1 element - the host node. So the end result is the same.

             

            I'm using JBoss EAP 6.1.

             

            Btw. once the cluster is started, the master node outputs:

             

            [org.jboss.as.clustering] (Incoming-1,shared=udp) JBAS010225: New cluster view for partition ejb (id: 1, delta: 1, merge: false) : [master:test-master/ejb, comp2:test-slave/ejb]

             

            On the slave node I see:

             

            INFO  [org.jboss.as.clustering] (MSC service thread 1-4) JBAS010238: Number of cluster members: 2

             

            So the servers are aware of each other.

            • 3. Re: Load-balancing EJB calls from an EJB client
              wdfink

              How your jboss-ejb-client.xml look like? Did you see any problems with the remoting connections within the logfile?

              Maybe this post helps Re: JBOSS AS 7.2 Remote EJB Lookup