Load blancing MQTT broker

chochim picture chochim · Jul 11, 2015 · Viewed 11.3k times · Source

Is it possible to load balance MQTT broker? Can I use ELB to load balance MQTT? Any pointers in this direction would be helpful. I hit upon http://www.slideshare.net/kellogh/mqtt-kafka-33100776 but it did not help much.

Answer

Dominik Obermaier picture Dominik Obermaier · Jul 12, 2015

Load balancing MQTT brokers is not supported out-of-the-box by most MQTT brokers. There are brokers available which support clustering, though. Take a look at this list to find out a broker which suits your clustering requirements.

This blog post is a bit dated but might still be useful if you want to learn about MQTT broker clustering: http://www.hivemq.com/building-a-high-availability-mqtt-cluster/

To answer your question: The MQTT broker HiveMQ works perfectly with AWS ELB for load balancing across several availability zones. You might want to increase the default ELB timeout for TCP connections to your MQTT keep-alive time you are using for your application. You can even use Auto Scaling groups for scaling elastically if needed. HiveMQ can use S3 for the discovery of other cluster nodes so you can add and remove cluster nodes at runtime.

I don't know if other brokers work as seamlessly with the AWS ELB. If HiveMQ does not suit your needs, best would be to search for a broker in the list linked above and try it :)

Disclaimer: I'm working for the company which develops HiveMQ.