[zeromq-dev] recv() on a ZMQ_REQ socket is slow

Doron Somech somdoron at gmail.com
Sat Oct 1 16:32:23 CEST 2016


REQ-REP pattern is slow because zeromq is not tuned for one message at a
time but for batch of messages. I suggest to use the dealer-router or
better the client-server.  You can use uuid or just sequnce number for
request identifier. However if your use case is one message at the time so
the benefit of zeromq will be throughput at the server side.

On Thu, Sep 29, 2016, 01:30 Dimos Stamatakis <dimstamat at gmail.com> wrote:

> 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
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20161001/5e8b34e0/attachment.htm>


More information about the zeromq-dev mailing list