[zeromq-dev] Regarding the following architecture:

Dimitris K. alcarlosse at gmail.com
Thu Nov 1 22:19:12 CET 2012


I have a server that uses a ZMQ_XREP/XREQ pair of sockets and a ZMQ_QUEUE
device to work with them. The messages are processed by pthreads.

Since some of the processing may take a long time, the client frequently
"pings" the server, by means of a zmq message in order to make sure it's
still alive. Each message's first part is 2 bytes specifying the type of
the request (including "ping").

However, I discovered the following problem:

Say we have 4 pthreads and the first message we get is a time-consuming
request, say 60 seconds. This goes to pthread #1.

After 5 seconds, the client pings, which goes to pthread #2.
After 10 seconds, the client pings, which goes to pthread #3.
After 15 seconds, the client pings, which goes to pthread #4.

At 20 seconds, when the client pings again, the message is assigned to
pthread #1 and is queued, waiting for the very first message to be
processed. So the client thinks the server is down and times out.

Any suggestions on how to handle this issue in general, and preferably with
minimal changes to the structure?

Thank you,
Dimitris K.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20121101/5e456ae3/attachment.htm>


More information about the zeromq-dev mailing list