[zeromq-dev] async client design

Ilja Golshtein ilejncs at narod.ru
Fri Aug 13 13:33:12 CEST 2010


Hello!

I am thinking about single thread client design. 

The server is parallel, some requests are slow, so it must be possible to send N+1 request before Nth is processed.
The problem is client have to associate response with request for further processing.

Actually, the option (0) is to send some extra data together with request and simply get it back from server, though it is not perfect because
of traffic considerations.

Option (1): 
One XREQ socket.
Some storage for extra info (e.g. std::map<REQUEST_ID, EXTRA_INFO>), 
request_id sent as part of a message and returned from server.


Option 2: 
Pool of REQ sockets.
Some storage for extra info (e.g. std::map<ZERO_MQ_SOCKET, EXTRA_INFO>).
When zmq_poll is done, client looks for extra_info based on socket fired.

Please, comment option (2). Is it Ok to have several dozens REQ sockets? Is it true this approach
leads to the same number of TCP connections between client and server?

Suggestions are appreciated.

Thanks.

-- 
Best regards,
Ilja Golshtein.



More information about the zeromq-dev mailing list