[zeromq-dev] recv() on a ZMQ_REQ socket is slow
Dimos Stamatakis
dimstamat at gmail.com
Thu Sep 29 00:30:32 CEST 2016
Hi everyone,
I have been testing the ZeroMQ library combined with Thrift to compare the
performance. I have a simple ZeroMQ example where I create ZMQ_REP and
ZMQ_REQ sockets for a simple client-server communication. In the example,
client simply sends a message to the server and waits for a reply. The only
slow part I measured is the client receive, which makes sense. But it is
almost three times slower than a native TCP socket.
So the actual benchmark is the Thrift with ZeroMQ, as officially released
by apache:
https://github.com/apache/thrift/tree/master/contrib/zeromq
I measured the overhead of using ZeroMQ for Thrift's communication, instead
of a native TCP socket.
The client response is much higher when using ZeroMQ and I was expecting to
be caused by the copying that must be done from Thrift data structures to
ZeroMQ data structures (zmq::message_t).
However the copying is negligible. The actual overhead is the recv() of the
client, waiting for the server to reply. Is it normal for a ZeroMQ REQ-REP
socket to be almost three times slower than a native TCP socket? Is there
something I can do to optimize it? I am using the default send and recv
with no flags.
I thought that maybe something is wrong with the way Thrift-ZeroMQ is
implemented so I also ran the hello example:
http://zguide.zeromq.org/cpp:hwserver
This also takes more time in the recv().
Many thanks in advance,
Dimos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20160928/79e1aa8d/attachment.htm>
More information about the zeromq-dev
mailing list