How efficient are topics? Can we use hundreds of them?

Asked by Steven Luke

I am setting up an MQTT system and am wondering about how efficiently mosquitto will handle many topics. The initial plan is this:

I have about 10 instruments as sources for publication, and a few (1 to 5) as subscribers. The publications can be about 10/sec on each instrument.

Our initial design was to have a small set of topics for each device, and each message be prefaced with a 'command':
Topic: system/<instrument name>/status
Messages:
  device.position.x=...
  device.position.y=...
  device.position.z=...

There would be about 100 or so such message commands in the status topic. There would be a few other topics, each with about 20 or less message commands defined.

We want to change things to control access to particular message command, and the easiest way to do that would be to convert the commands into topics:
Topics:
  system/<instrument name>/status/device/position/x
  system/<instrument name>/status/device/position/y
  system/<instrument name>/status/device/position/z

Then control subscription to each topic. The plus side is that each subscriber can cherry pick the topics to listen to, which can cut down on message transport and make client side coding a bit easier. But this would lead to maybe 200 or so topics per instrument, or 2000+ topics for a single broker. Would this cause efficiency problems with mosquitto?

Thanks for your help.
Steve

Question information

Language:
English Edit question
Status:
Solved
For:
mosquitto Edit question
Assignee:
No assignee Edit question
Solved by:
Steven Luke
Solved:
Last query:
Last reply:
Revision history for this message
Roger Light (roger.light) said :
#1

I see no reason why this should be a problem. There are around 10,000 topics with retained messages on test.mosquitto.org, although this doesn't mean those topics are active of course.

I refer you to this email: https://lists.launchpad.net/mosquitto-users/msg00110.html "My test involved 100K clients subscribed to 100K topics."

Does that answer your question?

Revision history for this message
Steven Luke (stevejluke) said :
#2

It most certainly does. That is great. Thanks.