RabbitMQ load balancing and high availability

84 views
Skip to first unread message

Michael G

unread,
Mar 27, 2019, 11:19:07 AM3/27/19
to rabbitmq-users
Hi,

I created a RabbitMQ cluster with two nodes with high availabilty. So alle queues get mirrored in the case for an failover. I have a load balancer in front of the cluster which will forward the request to node b, if node a is down. 

Can I provide load balancing and high availability simultaneously because using the load balancer I can define for instance a round robin behaviour. But there the problem is as far is I understand, when the load balancer doesn't know the master queue you get in the worst case redirected from node b to node a where the master queue is situated. In this case I'm concered of the performance because I read in a blog post that the performance is far better connecting directly to the master node of the queue. What are possible options to solve this problem, without providing the client the information directly on which node the queue is situated. 

Luke Bakken

unread,
Mar 27, 2019, 2:57:46 PM3/27/19
to rabbitmq-users
Hi Michael,

Don't worry about what node runs the master queue. The only way to know if connecting to the master queue node would help in your environment is to know your expected workload and to run benchmarks using it. Otherwise, it's not worth the extra headache of tracking what node hosts the master queue.

Thanks,
Luke

Michael G

unread,
Mar 27, 2019, 5:48:49 PM3/27/19
to rabbitmq-users
Hi Luke,

thanks for your reply then I will forget to track all the information. Maybe you can help me out deciding the load balancing strategy.

What load balancing strategy makes the most sense from a performance perspective?

- Declare all master queues on node a. Redirect all the traffic to node a and only to node b when a failover occurs. So in this scenario all requests will be directed to the queue master.

- Declare all queues with the min-masters option. So creating the queue selects the master node as the one with the least running master queues. Redirect the traffic in a round robin manner. In this case it could happen that all connections will go through the slave node.

Luke Bakken

unread,
Mar 28, 2019, 10:43:14 AM3/28/19
to rabbitmq-users
Hi Michael,

First of all, a two-node cluster is not recommended (https://www.rabbitmq.com/ha.html).

Again, the best advice depends on your specific use-case and environment. If you have a few queues with low message rates, you're probably OK with all queues running on one node. Beyond that it's best to spread out queue masters as much as possible.

Verify with testing and benchmarks.

Luke

Michael G

unread,
Apr 1, 2019, 5:38:02 AM4/1/19
to rabbitmq-users
Hi Luke,

ok, thanks for your help.
Reply all
Reply to author
Forward
0 new messages