[zeromq-dev] Round robin problems with offline servers

Pieter Hintjens ph at imatix.com
Fri Jun 1 13:33:56 CEST 2012

On Fri, Jun 1, 2012 at 11:43 AM, Ben Gray <ben at benjamg.com> wrote:

> Short of setting all the send high water marks to 0 messages is there
> a good work around to stop buffering for none connected pipes?

You cannot use HWM effectively for flow control.

The simple and effective way to solve your problem without modifying
the library is to switch to a ROUTER-DEALER patten and use some form
of flow control, even if it's just an initial "READY" message

> a) attempt a connection to the server on a different socket and then
> use the new monitor callbacks to see if it gets connected, at which
> point tell the main socket to connect to it instead.

Won't work since each connection happens asynchronously so you can
easily get the backup socket connecting while the main socket is still
waiting. Also, nasty.

> b) patch the code to provide a socket option that treats connecting as
> though the pipe is full.


> The first option seems overly messy to me, but if I'm going to patch
> the library I want to check if someone has a better solution first, or
> a better patch.

No harm from taking an editor to the code and seeing what happens.
This is definitely what I'd do. If you have questions on the
internals, pose them, there are people like Martin Hurton with more
than enough knowledge to answer them.

> Actually I don't see the benefit of a round robin using connecting
> pipes while others are still active, so this might even tread in bug
> territory.

This is right. Please, file an issue with test cases (a C test case
ideally), and lets fix this. If you want a work around in the
meantime, use a variant on the LRU model.


More information about the zeromq-dev mailing list