In an application that publishes many MQTT messages per second (approximately 100), I can only get it to work with QoS=0. As soon as I set QoS=1, the messages accumulate in the queue and are not published at the desired rate. I created a simple test project, believing that the problem could be running the client in a separate thread, but I see that the same thing happens with a simple form with the client in the main thread. I have tried different brokers (local Mosquitto, test.mosquitto.org, HiveMQ) and the same thing happens with all of them. It sends 10 messages and hangs, perhaps waiting for something... I have tried other client components in Python and GoLang, and they work perfectly.
The test is simple, publish 1 incremental value to 100 topics at a time, every second, and view the result in MQTT Explorer.
TestTmsMQTT.zip (74.7 KB)
We released an update now with an improvement.
I'm still seeing version 2.0.9.0, but I'll be on the lookout for it to try.
Thank you.
The release is available now.
I just tested the new version, and indeed, with one packet per cycle, it no longer blocks. But I don't quite understand why it's limited to one packet per cycle. This way, although it works, the transfer rate is very low, less than10 packets per second with QoS=1 and less than 5 with QoS=2, which in practice means it's not usable in most contexts.
Is there any way to speed this up? I've tried lowering the CommThreadInterval, but I haven't seen any significant change.
Can you please check the High Performance demo.
Setting the "Read timeout (ms)" setting to a low value increases the speed.
The fastest setting will always be using QoS = qosAtMostOnce and switching SendOnePacketPerCycle off. All other QoS values require one or more acknowledgements that will slow down the process, specially on distant brokers.
Using a broker running in the same computer or the local network give much better results than using a public broker like test.mosquitto.org
Additionally, some brokers have limits :
https://stackoverflow.com/questions/65450457/mosquitto-mqtt-broker-wont-send-more-than-20-publish-packets-to-subscriber