[zeromq-dev] Will socket multiplexing improve throughput?
william.brown at ericsson.com
Tue Feb 7 14:57:37 CET 2012
We're using the multiple-socket model in our work. We've abstracted out several
of the major "topologies" that ZeroMQ supports into a higher level application
library. Each of these topologies essentially supports one-way, asynchronous
transmissions. Round trip request/response messaging is accomplished using transactionIDs
that are part of the message payload. Clients transmit message payloads on one socket
topology and eventually receive a response to that message on another socket topology.
The transactionID helps to correlate the original request with the proper response. We've
also extended the payload model to include the concept of routing documents. This allows
for a single request to be routed through multiple service implementations before the final
result is returned to the original caller. This allows for excellent separation of concerns
The reason we went this route is because of the complexities of two-way communications
using a single socket and all of the synchronization headaches that go along with it.
From: zeromq-dev-bounces at lists.zeromq.org [mailto:zeromq-dev-bounces at lists.zeromq.org] On Behalf Of Staffan Gimåker
Sent: Tuesday, February 07, 2012 5:15 AM
To: ZeroMQ development list
Subject: Re: [zeromq-dev] Will socket multiplexing improve throughput?
On Tue, 2012-02-07 at 10:01 +0800, Qing Yan wrote:
> 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 wrong).
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.
zeromq-dev mailing list
zeromq-dev at lists.zeromq.org
More information about the zeromq-dev