Will Mosquito work in the production environment?

I'm implementing a project with Node-Red where I want to track and control several drones with a dashboard I designed using uibuilder. I want to use mqtt protocol to communicate between drones and NR.
The question that comes to me is whether deploying mosquito on the server will answer my needs or not? (in terms of efficiency and speed)

Long answer...
Without details of how much data and how often, server hardware spec, network speeds, we can not say! Even with this details we couldn't give you a number. You would simply have to try it out.

For reference, some benchmarks say 20000 messages per second, others say 60000. Of course it is entirely dependant on the server capabilities, network connections, etc etc etc.

E.g Basic benchmarks of 5 different MQTT brokers

Short answer...
Probably, yes

1 Like

As the Long Answer above, it depends on the spec of the IT environment around for the performance.
The main issue with mosquitto, for me, is that it can't be clustered. So performance is limited to one a single instance can do and redundancy is missing.
If MQTT is used in a 24/7 operation where all component are set up in clusters, or active/active mode, or even active/passive mode, then mosquitto appears as a weak spot. It might not be an issue in your case, though. In IT production, it is.

1 Like

I would have thought that node-RED, rather than mosquitto would have a greater impact on speed and responsiveness, as it's single threaded (whilst mosquitto isn't), and if the processor is busy doing something else, then there could be a lag in instructions reaching Mosquitto.

[EDIT by Paul] - post updated to reflect comments below

1 Like

Mosquitto is single threaded

2 Likes

Mosquitto is single threaded (or rather v1 was definitely single threaded, and no mention of multi threading since, that I can find)

https://wiki.eclipse.org/Mosquitto/Multi-Thread

Multi-thread support is planned. Work being done has threads under consideration, but there isn't a concrete timetable on when multi-thread support will be implemented. This would likely be cause for an x.0 release, however.

http://www.scalagent.com/IMG/pdf/Benchmark_MQTT_servers-v1-1.pdf

Mosquitto succeeds in handling 60.000 publishers despite a high level of CPU usage probably
caused by the way connections are handled. The high transmission latency suggests that
messages are buffered before being processed. Mosquitto is single threaded which explains the
maximum CPU at 50% of the dual-core

benchmark: https://www.proquest.com/docview/2576402261

It is to be mentioned that Mosquitto is a single-threaded implementation,

2 Likes

I agree with @Paul-Reed, if the messages going through mosquitto are going to and coming from node-red then the overheads in node-red will be vast compared to those in mosquitto.

2 Likes

What hasn't been covered in the thread so far is the question of how many messages are you anticipating?

When you say "control", do you mean real-time control? How much control intelligence is built into the drones (e.g. intelligent object avoidance, GPS track following, etc) or into an intermediate control server and how much must Node-RED provide?

Similarly with the tracking. How accurate do you need the tracking to be? That will help determine the data throughput needed along with the maximum latency you could handle.

Remember that Node-RED is certainly not a real-time service, not by a long way. Similarly, any message queue service is not designed to be real-time, quite the opposite in fact.

So quite a number of answers are needed before you can realistically say how much Node-RED and MQTT might help with your architecture.

1 Like

My goal is not real-time control of drones. The drones are completely intelligent and have a control system and autopilot module. I just want to have a user panel to manage them, for example, run a series of algorithms and give them the result along with the command, and they send me their flight coordinates so that I can track them.

I don't have any idea about this at the moment, I just want the drone to send me its coordinates every half second (for example) and the battery level every few minutes via MQTT. The reason I want to use MQTT is because I want to test multiple drones together.

2 Likes

You have not said what hardware you are planning to use, but even on something like a Pi Zero mosquitto and node-red will handle hundreds of messages a second. Your user display is going to take a lot more resources than mosquitto and node-red.

2 Likes

Hardware on the drone or on the server?
I am currently in the development stage and have not made a decision yet, but if the hardware is not responsive, I have no problem with upgrading it.

On the server. I assumed that you are planning to run node-red and mosquitto on the server.

Yes, I want to deploy a dockerized service on the central server using NR, Mosquito, and MongoDB.

OK, that is good, I thought for a moment that you might be trying to control them from node-red! :rofl:

Nice.

You will need to take some care over that probably so that you get the right balance between data and performance.

It will work well as long as you manage the overall data flows.

Can you please tell me more precisely what you mean by these two sentences?

The data you get from the drones could be significant so you will need to keep an eye on how much you are getting and what impact you will have if there is so much that so start to miss some or it gets delayed. Will your processing cope with that? If not, you will need to work out whether you can reduce the data or work out what can safely be dropped.