[zeromq-dev] Heartbeats and/or keep-alives

Pieter Hintjens ph at imatix.com
Wed Oct 13 12:21:15 CEST 2010

Hi Marcelo,

You're hitting an issue that most 0MQ users come to sooner or later.
0MQ sockets do not, currently, do any kind of heartbeating over TCP
though this is something I'm pretty sure they eventually will need to

The solution is fairly simple, add heartbeating to whatever protocol
you are building on top of your 0MQ sockets.  That sounds complex but
it really is pretty simple to add socket flows into a 0MQ application.
 So typically you create a socket pair that pushes heartbeats up from
client to server (or whatever), or you add heartbeat messages into the
other traffic.

I'll cover this in Chapter 4 of the user guide.


On Wed, Oct 13, 2010 at 4:46 AM, Marcelo Cantos
<marcelo.cantos at gmail.com> wrote:
> I've been looking around for information on how (if?) ZeroMQ deals with
> flaky networks, and have found very little beyond an
> inconclusive exchange on the subject of keep-alives.
> I am very keen to try a migration from RabbitMQ to ZeroMQ, but this is quite
> a sticking point, since we have found that our network tends to deaden
> long-idle connections — they don't die, they just stop sending data. I'm
> guessing this is due to our use of el-cheapo networking hardware, but
> haven't investigated in any depth. In RabbitMQ, we managed to rid ourselves
> of the problem by setting the RequestedHeartbeat field on each client
> connection to a reasonable value (five minutes seems to do the trick).
> I have confirmed that ZeroMQ also suffers from deadened idle connections on
> our network, for which the only fix seems to be to restart both peers. Has
> any progress been made (or at least further discussion had) on how to deal
> with this? Is there a solution that is as simple and unobtrusive as what we
> did with RabbitMQ? Is there any solution at all that doesn't require manual
> restarts?
> Sincerely,
> Marcelo Cantos
> Melbourne, Australia
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Pieter Hintjens
iMatix - www.imatix.com

More information about the zeromq-dev mailing list