Distribution of messages to shared subscribers is not very balanced

From a single client, I’m publishing to a single topic 100,000 messages.

I have four other clients, that are subscribing to the topic in a group:
$share/mygroup/mytopic

At the end of the test, the four subscribers have collectively received 100,000 messages (good news) however one subscriber received 79,669 messages and the others 6,432 and 6,834 and finally 7,065.

In our case the goal of the shared subscription is the distribute the work of processing published messages across a scalable number of machines. I wonder what it is that I may be doing incorrectly.

1 Like

Hi @rshillington ,

your subscribers are too fast;) Shared subscriptions will try to saturate the downstream mqtt clients on a best effort basis.

Try introducing some simulated work (Thread.sleep()) or something along the lines.

All the best
Georg

1 Like