-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UNIX socket vs localhost performance differences #1564
Comments
As a sanity check, I also ran wireshark during a localhost test. It showed a 0.093ms response time for the connect call, as the difference in the timestamps between the CONNECT and CONNACK packets.
So the 10ms client time is not from the server being slow to respond. |
Here is a log dump of a TCP run...
This seems to be the main delay: The connect is waiting on a condition variable that probably isn't being signaled and instead is likely waiting on a 10ms timeout to continue (from above):
The UNIX socket run doesn't have that delay (partial log dump):
|
After implementing the UNIX-domain socket support, I was surprised at the difference in performance between the UNIX sockets and TCP over localhost. I would normally expect a 20-50% improvement with UNIX sockets, but was seeing substantially more than that with the Paho client - like a 90% drop in latency for small that just emit a few messages and close.
So as a quick test to compare performance, I created a simple MQTT client to (1) create a client, (2) connect, (3) publish a single 1kB messages, and then (4) disconnect. I then ran it with a locahost TCP URL and then a UNIX socket URL. Here's how a few runs compared, with all times given in milliseconds:
So the major performance difference appears to be the call to
connect
!Some info and disclaimers:
The text was updated successfully, but these errors were encountered: