4 Replies Latest reply on Sep 6, 2010 10:56 AM by davsclaus

    Load balancing in brokers network




      I have Fuse 4.2 with three instances created (node1, node2 and node3). I configured network of brokers for these instances - brokers addresses were specified in  configurations of activemq for each instance (activemq.xml placed in container etc/ directory) using static addresses declaration.

      For example node1 broker address is tcp://localhost:61626 and in this broker configuration in network connectors section node2 and node3 brokers addresses are set in following way:




      When I run this example I see that all messages from node1 (where Producer is deployed) are processed only by one consumer (for example node3).

      Is there any way to configure load balancing in brokers network or flows ? I expect that consumers deployed on node2 and node3 are both processing messages (for example 10 would be processed by consumer on node2 and 10 by consumer on node3).


      I try use conduitSubscriptions="false" option in networkConnector element and use jms.prefetchPolicy.all=1 option in broker address in flow but both these options doesn't help.


      Thanks in advance 


        • 1. Re: Load balancing in brokers network

          For a network connector, the prefetch is configured using the prefetchSize attribute of the network connector, it defaults to 1000.

          <networkConnector prefetchSize="1" ...>


          I wonder if both network connectors are 'up' when the messages are produced. If you have JMX enabled, can you validate the network connector on node2 is active? Consumers on a queue have round robin dispatch by default which should evenly distribute the load, so you should see an even distribution of messages across both consumers through the network bridges provided they are active.

          • 2. Re: Load balancing in brokers network


            Thanks for your answer.

            Jmx is enabled for all brokers and all connections are active when producer generating messages.




            • 3. Re: Load balancing in brokers network

              I found the solution. All messages was processed only by one broker because networkTTL parameter in networkConnection element is by default set to 1. When it was changed to value 3 then part of messages was processed by node2 and others by node3.

              • 4. Re: Load balancing in brokers network

                Check out Rob's last 2 webinars on ActiveMQ which is posted at fusesource. He explains network topology and the TTL option (which may have a bad name as its really network hobs).