Load Balancing

Sender Load Balancing

Senders can be load balanced across the network of brokers, by concentrating them on a set of brokers in the network. For example, in a Mesh network of 3 brokers, senders can be spread across NoB1 and NoB2. The receivers can be connected to NoB3.

Receiver Load Balancing

Receivers can also be distributed across brokers. In Network Of Brokers, it is possible to configure network connectors to distribute messages in multiple ways, depending on how you want messages consumed. In the networkConnector configuration you should have noticed an attribute named conduitSubscriptions. This setting specifies how the messages are distributed. By default, AmazonMQ sets conduitSubscriptions to false

conduitSubscriptions enabled

When conduitSubscriptions is set to true, taking an example (see above diagram), when Sender1 sends 60 messages to NoB1, NoB1 sees two connections, one for NoB1 and another for Receiver1. So, it distributes 60 messages, 30 each for NoB1 and the remaining 30 for Receiver1. For NoB2, since there are two receivers, each receiver receives 15 messages each. This is an uneven distribution of messages.

In order to distribute the messages evenly among all subscriptions, conduitSubscriptions should set to false (default in AmazonMQ).

conduitSubscriptions disabled

When conduitSubscriptions set to false, taking an example (see above diagram), when Producer1 sends 60 messages to NoB1, NoB1 sees three connections, one receiver for NoB1 and two receivers on NoB2 and distributes messages equally among all receivers. Each receiver receives 20 messages.