paho.mqtt.c icon indicating copy to clipboard operation
paho.mqtt.c copied to clipboard

did any one tested what was the highest speed to publish message(qos1)?

Open ldxsdyx opened this issue 3 years ago • 5 comments

I call MQTTAsync_send(qos1) many times(about 100 times) and then print log at deliveryComplete callback function, it get result about 2 messages/second averagely. I compiled the libpaho-mqtt3as.so.1.3.9 again, use the cmake -DNO_PERSISTENCE=TRUE and -DPAHO_HIGH_PERFORMANCE=TRUE options and get the same result.

This is too slow for my business, someone can help me?@icraggs

my paho code commit id is 3b7ae6348bc917d42c04efa962e4868c09bbde9f.

ldxsdyx avatar Sep 15 '22 13:09 ldxsdyx

the message is about 200 bytes string.

ldxsdyx avatar Sep 15 '22 13:09 ldxsdyx

it's related to #1256 ... 1.3.9 is slow and it's a know issue.

jumoog avatar Sep 15 '22 13:09 jumoog

I upgrade to 1.3.10, but got the same result...

ldxsdyx avatar Sep 15 '22 14:09 ldxsdyx

some log as blow: 2022-09-15 13:47:32.7406 DEBUG 86686 ServerSimu (Simulation.cpp:172): Delivery Complete token_3 20220915 134732.741 6 debug-ut <- PUBACK msgid: 2 2022-09-15 13:47:32.7420 DEBUG 86686 ServerSimu (Simulation.cpp:172): Delivery Complete token_2 20220915 134733.691 6 debug-ut -> PUBLISH msgid: 4 qos: 1 retained: 0 rc 0 payload len(579): { "body" : {

20220915 134733.691 6 debug-ut -> PUBLISH msgid: 5 qos: 1 retained: 0 rc 0 payload len(579): { "body" : {

20220915 134733.843 6 debug-ut <- PUBACK msgid: 4 2022-09-15 13:47:33.8438 DEBUG 86686 ServerSimu (Simulation.cpp:172): Delivery Complete token_4 20220915 134733.843 6 debug-ut <- PUBACK msgid: 5 2022-09-15 13:47:33.8440 DEBUG 86686 ServerSimu (Simulation.cpp:172): Delivery Complete token_5 20220915 134734.692 6 debug-ut -> PUBLISH msgid: 6 qos: 1 retained: 0 rc 0 payload len(579): { "body" : {

20220915 134734.692 6 debug-ut -> PUBLISH msgid: 7 qos: 1 retained: 0 rc 0 payload len(579): { "body" : {

20220915 134734.790 6 debug-ut <- PUBACK msgid: 6 2022-09-15 13:47:34.7906 DEBUG 86686 ServerSimu (Simulation.cpp:172): Delivery Complete token_6 20220915 134734.790 6 debug-ut <- PUBACK msgid: 7 2022-09-15 13:47:34.7908 DEBUG 86686 ServerSimu (Simulation.cpp:172): Delivery Complete token_7 20220915 134735.693 6 debug-ut -> PUBLISH msgid: 8 qos: 1 retained: 0 rc 0 payload len(579): { "body" : {

20220915 134735.693 6 debug-ut -> PUBLISH msgid: 9 qos: 1 retained: 0 rc 0 payload len(579): { "body" : {

20220915 134735.760 6 debug-ut <- PUBACK msgid: 8 2022-09-15 13:47:35.7610 DEBUG 86686 ServerSimu (Simulation.cpp:172): Delivery Complete token_8 20220915 134735.761 6 debug-ut <- PUBACK msgid: 9 2022-09-15 13:47:35.7613 DEBUG 86686 ServerSimu (Simulation.cpp:172): Delivery Complete token_9 20220915 134736.694 6 debug-ut -> PUBLISH msgid: 10 qos: 1 retained: 0 rc 0 payload len(579): { "body" : {

20220915 134736.694 6 debug-ut -> PUBLISH msgid: 11 qos: 1 retained: 0 rc 0 payload len(579): { "body" : {

20220915 134736.862 6 debug-ut <- PUBACK msgid: 11 2022-09-15 13:47:36.8630 DEBUG 86686 ServerSimu (Simulation.cpp:172): Delivery Complete token_11 20220915 134736.863 6 debug-ut <- PUBACK msgid: 10 2022-09-15 13:47:36.8633 DEBUG 86686 ServerSimu (Simulation.cpp:172): Delivery Complete token_10 20220915 134737.695 6 debug-ut -> PUBLISH msgid: 12 qos: 1 retained: 0 rc 0 payload len(579): { "body" : {

20220915 134737.695 6 debug-ut -> PUBLISH msgid: 13 qos: 1 retained: 0 rc 0 payload len(579): { "body" : {

20220915 134737.762 6 debug-ut <- PUBACK msgid: 12 2022-09-15 13:47:37.7622 DEBUG 86686 ServerSimu (Simulation.cpp:172): Delivery Complete token_12 20220915 134737.762 6 debug-ut <- PUBACK msgid: 13 2022-09-15 13:47:37.7624 DEBUG 86686 ServerSimu (Simulation.cpp:172): Delivery Complete token_13 20220915 134738.696 6 debug-ut -> PUBLISH msgid: 14 qos: 1 retained: 0 rc 0 payload len(579):

ldxsdyx avatar Sep 15 '22 14:09 ldxsdyx

As outlined in #1256 you can use the develop branch or use the compile definition USE_SELECT to avoid this problem for now.

icraggs avatar Sep 21 '22 09:09 icraggs

I tried this scenario with test.mosquitto.org with the current develop branch and got 68 messages per second. WIth a local mosquitto instance, I got around 7400 messages per second.

The speed will depend on the speed of the client and broker machines, and the network between them, of course.

icraggs avatar Sep 22 '22 16:09 icraggs

This is because I set maxInflight = 2 in connect optios .....

ldxsdyx avatar Oct 10 '22 05:10 ldxsdyx