[zeromq-dev] Blocking on multiple outputs

Pieter Hintjens ph at imatix.com
Wed Jun 1 19:33:46 CEST 2011


Hi Martin,

Random question about avoiding deadlocks on writing to multiple
outputs. The use case is multiple clients that connect to a server (or
a device) and request data. The server responds to clients with large
amounts of data (a stream, let's say). Clients are misbehaved, slow,
etc.

The socket pattern is an XREP/ROUTER at the server, and an XREQ/DEALER
at the client. (I'd assume, but if you have a better suggestion, tell
me). We use transient sockets, so generated identities.

Now to avoid memory exhaustion, the server sets a HWM. Each client
output queue is independent, each is limited to the same HWM.

We now get the situation where one slow client reaches its queue
limit. At this stage, the server either blocks on send, or receives
EAGAIN if it's doing non-blocking sends.

Consequence: one slow client blocks all clients.

What's the best way around this?

-Pieter



More information about the zeromq-dev mailing list