[zeromq-dev] Will socket multiplexing improve throughput?

Staffan Gimåker staffan at spotify.com
Tue Feb 7 11:15:06 CET 2012

On Tue, 2012-02-07 at 10:01 +0800, Qing Yan wrote:
> Hi,
>    I have a general question about zmq. Say my goal is to gain max
> throughtput between two nodes. Is there advantge to establish multiple
> sockets between them, or
> one pair is enough and ZMQ will take care of the optimization?
> Assuming the data source is multithreaded
> 1) create one socket pair + synchronized access
> 2) one pair for each thread w/o synchronization
> How much better will 2) compare to 1)?Is it worth the complexity?

If ZeroMQ is the bottleneck, i.e. not the data source itself, then 2)
will fare better, for two reasons:

 * No synchronization.
 * Each zmq socket is limited to one io thread (correct me if I'm

If you use multiple sockets you can utilize multiple io threads, which
should give you better throughput.

How much better it will be (it depends) or whether or not it's worth the
effort (can't see why it should be much more effort) I will refrain from
speculating about.


More information about the zeromq-dev mailing list