[zeromq-dev] REQ-REP Timeouts in PyZMQ

Dustin Webb daemonmaker at gmail.com
Fri Nov 21 16:01:08 CET 2014


Okay, so I think I'm getting a better handle on this. It appears I can use
the set method on the socket to control how long the recv method will wait
(infinite by default) and how long a request will linger in memory on the
server (infinite by default). As far as I can tell PyZMQ respects these
defaults. Am I following this correctly so far? If so, then I assume when
using TCP, is there some form of keep alive message sent periodically from
the client to the server to indicate that it's still waiting or does the
server just assume the client is waiting until the client disconnects? In
other words what kind of traffic is there between the client and the server
while the client is awaiting a respone?

On Fri Nov 21 2014 at 09:27:45 Benjamin <benjamin.l.cordes at gmail.com> wrote:

> The default value is -1 (infinite). Not quite sure what you mean with
> threads. If you run a socket in in the main thread that should work.
> PyzMQ supports greenlets, if that's what you need. Usually each thread
> has it's own context.
>
> On Fri, Nov 21, 2014 at 3:19 PM, Dustin Webb <daemonmaker at gmail.com>
> wrote:
> > Is it necessary to do polling? I would prefer the client simply wait
> > indefinitely. I also notice that the example solution uses threads which
> I
> > was hoping to avoid for simplicity.
> >
> >
> > On Fri Nov 21 2014 at 09:10:20 Benjamin <benjamin.l.cordes at gmail.com>
> wrote:
> >>
> >> Hi,
> >>
> >> here is an example with polling:
> >> https://github.com/imatix/zguide/blob/master/examples/Python
> /asyncsrv.py
> >> So the client raises an exception after a pre-defined time-period (1
> >> second e.g.)
> >>
> >> Check out the socket options here
> >> http://api.zeromq.org/4-1:zmq-setsockopt   (ZMQ_RCVTIMEO and
> >> ZMQ_SNDTIMEO)
> >>
> >> On Fri, Nov 21, 2014 at 2:25 PM, Dustin Webb <daemonmaker at gmail.com>
> >> wrote:
> >> > Greetings everyone,
> >> >
> >> > I have recently written a train_extension for Pylearn2 that uses PyZMQ
> >> > to
> >> > let me query for data from my experiments. My train_extension works in
> >> > conjunction with a client that queries for the data and plots the
> >> > response.
> >> > The train_extension receives and responds to requests for data after
> >> > each
> >> > training epoch. However these training epochs can take a long time to
> >> > run,
> >> > e.g. any where from minutes to hours in the normal cases. As such I'm
> >> > wondering about timeout behavior. Put simply, will the connections
> >> > timeout?
> >> > And if so, under what conditions and how will the timeouts manifest?
> In
> >> > other words, will the send on the client raise a TimeOut exception
> after
> >> > a
> >> > certain period of time? And on the server side, what will happen to a
> >> > request that was received hours earlier?
> >> >
> >> > Thanks in advance,
> >> > Dustin Webb
> >> > Undefined Intelligence
> >> > Algorithmic Robotics Lab
> >> > Laboratoire d'Informatique des Systemes Adaptatifs
> >> >
> >> > _______________________________________________
> >> > 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20141121/fbfb5d3f/attachment.htm>


More information about the zeromq-dev mailing list