Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Websockets slow for large (ish) payloads #1390
I am having an issue where sending a 1mb+ payload over mqtt takes 5-10 seconds to complete over localhost.
The same request over tcp takes 32 ms.
I have created a repo that reproduces the issue: https://github.com/Smart-Ag/mqtt_bug_report
To run the repo:
I have tested the same clients with the emqx mosquitto broker and it was 10-40 times faster.
I was getting ~170ms per message. You can get this version by getting the fixes branch:
Are you ok compiling yourself or would you like help?
@ralight I just tested mosquitto docker image:
The emqx broker runs in 200 ms on scenario 1 & 2.
Any ideas on why there is such a difference in performance over local and internet?
That's bonkers. I've tested this out on test.mosquitto.org, which is under load but isn't using the docker image. Using pubsub.py I get:
Those results are pretty consistent across runs. I've tried with libwebsockets 2.4.2 and 3.1.0 with the same results. I haven't tried with the docker image yet.
If I understand what you are saying, you get 10,000ms latency right from the first message. Could you please try the python code with your instance to see what you get? You'll need the Paho python client paho-mqtt.