Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Pinging a worker to know if it is alive will cause a race condition: the worker might well answer the ping just before it dies.</p> <p>However, if you assume that a worker will not die <strong>during</strong> a request processing (you can do little in this case), you can reverse the flow of communication between the workers and the central queue. Let the worker fetch a request from the queue (using a <code>REQ</code>/<code>REP</code> connection) and have it send the answer along with the original envelope when the processing is done (using the same socket as above, or even better through a separate <code>PUSH</code>/<code>PULL</code> connection).</p> <p>With this scenario, you know that a dead worker will not be sent requests, as it will be unable to fetch them (being dead…). Moreover, your central queue can even ensure that it receives an answer to every request in a given time. If it does not, it can put the request back in the queue so that a new worker will fetch it shortly after. This way, even if a worker dies while processing a request, the request will eventually be served.</p> <p>(as a side note: be careful if the worker crashes because of a particular request - you do not want to kill your workers one by one, and might want to put a maximum number of tries for a request)</p> <p><strong>Edit:</strong> I wrote <a href="https://github.com/samueltardieu/zmq-broker" rel="nofollow">some code</a> implementing <a href="http://www.rfc1149.net/blog/2010/12/08/responsible-workers-with-0mq/" rel="nofollow">the other direction</a> to explain what I mean.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload