[zeromq-dev] ZeroMQ and hot server restarts

Merijn Verstraaten merijn at inconsistent.nl
Thu Oct 11 16:29:11 CEST 2012


Hey!

I've recently started messing around with ZeroMQ and so far I'm happy, but I have one question. With TCP sockets I am enable to do hot server restarts (i.e. start a new binary without dropping connections) by doing fork/exec which keeps the sockets open, meaning that (with some synchronisation between the old and new server) the new one can keep serving existing connections without dropping them.

I'm trying to achieve the same effect using ZeroMQ, but I'm not sure whether this is actually possible. As far as I can tell from the manual pages closing a socket will cause messages that are in-transit to be lost, there appears to be no way (without implementing your own specific protocol) to block a client's send attempts until the socket in the old process is closed and a new one bound in the new process. Other approaches I could come up with (such as HWM to 0 and have the behaviour for client sockets be to block) also don't look like they'll work.

So in short, my question is: Is there a way to switch to a new server process without dropping connection/losing messages (other than implementing my own synchronisation protocol)? If not, do you expect it'd be possible to implement this inside ZeroMQ (and where should I start looking if I was interested in implementing this)?

Kind regards,
Merijn Verstraaten


More information about the zeromq-dev mailing list