A few points: - replace the queue device with your own code which deals with the heartbeats itself and does not forward these to workers - re-read the Guide and probably move to version 3.2 - ping every second, treat N seconds' silence as a problem
The first point is essential; the others just recommendations. -Pieter On Thu, Nov 1, 2012 at 10:19 PM, Dimitris K. <[email protected]> wrote: > 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. > > > _______________________________________________ > zeromq-dev mailing list > [email protected] > http://lists.zeromq.org/mailman/listinfo/zeromq-dev > >
_______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
