[zeromq-dev] Automatic reconnection, blessing or curse?
Goswin von Brederlow
goswin-v-b at web.de
Wed Sep 10 18:37:04 CEST 2014
At work we leave GUI clients running connected to remote servers via
ZMQ all the time. But when we go home at night our local system get
suspended. When we come back in the morning and wake them up again the
GUI clients just keeps working because zmq will reconnect in the
background. So that is basically your "shutting the lid of your
laptop" case.
As for flaky networking there you will run into message loss. You will
need more than automatic reconnects and even heartbeating. You need to
resend requests when they get lost. So far that is left to the
application but I'm working on a protocol module for czmq that will
handle that for you so the application doesn't have to.
So zmq alone isn't the answere but with addons that are being
developed it is getting there.
MfG
Goswin
On Tue, Sep 09, 2014 at 11:10:23AM +0000, Tom Quarendon wrote:
> OK, sounds like it wouldn't be bending the technology too far. I don't want to just use zeroMQ for the sake of it, but if there's good value to be had, then I will use it. The good thing is that your guide explores good patterns to making different kinds of network topologies, so there's a lot that can be built upon.
>
> Thanks.
>
> -----Original Message-----
> From: zeromq-dev-bounces at lists.zeromq.org [mailto:zeromq-dev-bounces at lists.zeromq.org] On Behalf Of Pieter Hintjens
> Sent: 09 September 2014 12:06
> To: ZeroMQ development list
> Subject: Re: [zeromq-dev] Automatic reconnection, blessing or curse?
>
> You can certainly set-up a CURVE connection that will ignore TCP disconnects and reconnects. At the lower level, the two peers will re-negotiate and create a new session key, but that'll be invisible to your application.
>
> On Tue, Sep 9, 2014 at 12:33 PM, Tom Quarendon <tom.quarendon at teamwpc.co.uk> wrote:
> > OK, thanks Pieter. I was hoping I might get the guru :-)
> >
> > Can I pose my question in another way, just to make sure I understand?
> > I have an SSH connection to a remote machine from my laptop. If I close the lid of the laptop to go home, or walk to another office, the SSH connection dies. On the face of it, zeroMQ would seem to provide a solution to that. So would zeroMQ be a good fit as the basis of an SSH implementation that would survive me sleeping my laptop, or the Wifi being flaky? Ignore the fact that it wouldn't be compatible with SSH, and that it's probably simpler just to set up Kerberos, or certificate signon so that reconnecting is easy anyway etc, just can you say whether that would be a good thing to base an implementation of something like an SSH server/client pair on? Or would it be square peg round hole, it would work, but would be bending the technology? I'm just trying to get a handle on the kinds of things zeroMQ might be good for.
> >
> > There's a lot of thought and intelligence gone into zeroMQ and the things that surround it, and on the face of it seems like it and the surrounding patterns have the potential to make writing good network code easier, I just need to work out whether it's applicable to the kinds of things I want to do.
> >
> > Thanks.
> >
> > -----Original Message-----
> > From: zeromq-dev-bounces at lists.zeromq.org
> > [mailto:zeromq-dev-bounces at lists.zeromq.org] On Behalf Of Pieter
> > Hintjens
> > Sent: 09 September 2014 11:19
> > To: ZeroMQ development list
> > Subject: Re: [zeromq-dev] Automatic reconnection, blessing or curse?
> >
> > ZeroMQ does indeed hide some things which we're used to seeing with TCP.
> >
> > Even with TCP, if you want to maintain a connection for any length of time, you need heartbeating. Otherwise you will hit cases where TCP reports no error, yet the connection is effectively dead.
> >
> > We don't usually use REQ/REP in practice. Any realistic client-server work runs over DEALER/ROUTER.
> >
> > -Pieter
> >
> > On Tue, Sep 9, 2014 at 11:37 AM, Tom Quarendon <tom.quarendon at teamwpc.co.uk> wrote:
> >> I???m trying to get a handle on zeroMQ, and the when I read chapter 4
> >> of the guide, thing I keep thinking is ???isn???t all that complexity
> >> just a by-product of the fact that sockets automatically reconnect after failure????
> >>
> >>
> >>
> >> I want to do a very simple RPC application between two endpoints.
> >> Let???s say I want to something a bit like SSH or SFTP (it???s on my mind
> >> and I???m trying to understand whether zeroMQ would be a good fit for such an application).
> >> I can do this in raw TCP fairly easily, or at least I think I can,
> >> and if the connection goes down, then any attempt to read or write
> >> from the socket gives an error (the socket can survive the
> >> disconnection if you don???t actually try to send any data), so I know
> >> when either the server process crashes, the client crashes or the
> >> network cable gets unplugged while I???m trying to send traffic.
> >>
> >>
> >>
> >> Now in zeroMQ, using REQ/REP in a simplistic fashion, a number of
> >> things might happen. If the network cable is unplugged, then either
> >> the client will be unaware (if control is with it, that is it???s not
> >> waiting for a response), which is probably good, or the client will hang forever, definitely bad.
> >> Similarly if the server crashes when processing a request, the client
> >> will hang forever. If the client crashes, the server will never know.
> >>
> >> So you have to get into complications of polling the socket, applying
> >> timeouts, performing heart beating, adding serial numbers and
> >> retrying requests and so on, really to get round the fact that the
> >> connection will be automatically reconnected if the network is
> >> interrupted. Once you???ve done all of those things, how is what you end up with better than plain TCP/IP?
> >>
> >>
> >>
> >> So I suppose my question is, why is this a good idea? Is TCP actually
> >> less reliable than I think it is? Do I just not understand TCP enough?
> >> Am I just trying to think about zeroMQ too much like normal sockets?
> >> Maybe zeroMQ is just not appropriate for an application such as an SFTP server?
> >>
> >>
> >>
> >> Thanks.
> >>
> >>
> >>
> >>
> >> _______________________________________________
> >> zeromq-dev mailing list
> >> zeromq-dev at lists.zeromq.org
> >> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> >>
> > _______________________________________________
> > zeromq-dev mailing list
> > zeromq-dev at lists.zeromq.org
> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> > _______________________________________________
> > zeromq-dev mailing list
> > zeromq-dev at lists.zeromq.org
> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> _______________________________________________
> 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