Using MQTT with multiple subscribers

bzo picture bzo · Jan 26, 2016 · Viewed 8.8k times · Source

I'm using mosquitto (http://mosquitto.org/) as an MQTT broker and am looking for advice on load balancing subscribers (to the same topic). How is this achieved? Everything I've read about the protocol states that all subscribers to the same topic will be given a published message.

This seems inefficient, and so I'm looking for a way for a published message to be given to one of the connected subscribers in a round-robin approach that would ensure a load balanced state.

If this is not possible with MQTT, how does a subscriber avoid being overwhelmed with messages?

Answer

Dominik Obermaier picture Dominik Obermaier · Jan 26, 2016

Typically you design MQTT applications in a way that you don't have overwhelmed subscribers. You can achieve this by spreading load to different topics.

If you really can't do that, take a look at the shared subscription approach sophisticated MQTT brokers like MessageSight and HiveMQ have. This is exactly the feature you're looking for but is broker dependant and is not part of the official MQTT spec.