[zeromq-dev] Forwarder stops forwarding

Matt Weinstein matt_weinstein at yahoo.com
Wed Jun 16 00:12:31 CEST 2010

On Jun 15, 2010, at 5:39 PM, Pieter Hintjens wrote:

> On Tue, Jun 15, 2010 at 3:39 PM, Martin Sustrik <sustrik at 250bpm.com>  
> wrote:
>> What has to be done is implementing heartbeats on 0MQ level.
>> Btw, a survey: What's the timeout you would be willing to accept to
>> assert the connection is dead?
> There was an interesting thread on heartbeating on the HyBi list
> (discussing this in WebSockets).  If done too often it can destroy
> battery life on a mobile device.  So if the same stack is going to do
> 20ms heartbeats and 30s heartbeats, it probably does need to be a
> socket option.
> It might be possible to calculate a sensible (default) heartbeat
> heuristically by doing a roundtrip ping test but I suspect that's way
> too complex for our needs.
How about:

Use a one-way keep-alive (rather than a round-trip heartbeat) and make  
it adaptive. Each side would just look at their average sends per  
second, and maintain a fraction of that rate.  It would be easy to  
measure the rate by sampling a counter.

E.g. in the case where you had 1,000 messages per second, you might  
ensure 1/100th as many packets were sent (100 keep-alives per second,  
or one inserted every 100ms).

If you had a 100 message per second channel, this would result in one  
keep-alive every second.

As keep-alive rates change, a specially crafted OOB message would be  
sent to tell the other side what to expect.

If the channel ramped up to 100,000 packets per second, you might want  
to limit the heartbeat traffic, so the socket tweaks would be e.g.  
divisor (i.e. number of messages per keepalive) 100 in the above  
example, number of missed keep-alives to down a channel, max/min ms  
spacing, etc...  Reasonable defaults could be devised, such as  
divisor=100, max spacing=3000 ms/3 seconds, min spacing= 50ms.

How does that sound?


> -Pieter
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

More information about the zeromq-dev mailing list