[zeromq-dev] [PATCH] Add ZMQ_RCVTIMEO/SNDTIMEO sockopt (fix)
Martin Sustrik
sustrik at 250bpm.com
Sun Jun 12 18:35:55 CEST 2011
Hi Fabien,
> I understand the concern, I just wonder if this was a bottleneck issue
> at all: polling is the very last thing we try when there is no other
> message pending in the mailbox. So, basically, I think we only gain
> any performance when the throughput is low enough to let part of the
> system waiting for something to do.
The issue here is with latency, not throughput. You are right that as
far as throughput is concerned, it more or less does not matter. With
latency the state of affairs is a bit different.
> I'm also not sure if replacing
> the polling with the 4 ioctl calls really speed up things. Better
> optimization could /may be/ to use the RCV_TIMEO on the mailbox reader
> socket on the platform that support it (unless the behavior is
> unacceptable, like it seems to be the case on Windows, according to
> the doc). With MSG_DONTWAIT support, that's really reduce the number
> of syscalls a lot (a single recv in all case).
Yes. Agreed. The ioctl() thing should be used only if no other option is
available.
One more idea: Even ioctl() implementation can be optimised if mailbox_t
remembered the actual state of socket (blocking vs. non-blocking) and
issued ioctl() only if there was a need to change the state.
> So here the patch for the old blocking case behavior. I would see if
> I can implement the RCV_TIMEO options now. Someone else would have to
> check it on Windows however.
Yes. Not even speaking of platforms such as AIX or HP-UX etc. The code
is a bit fragile here. You should take care to keep the code as is for
platforms you cannot test on.
Martin
More information about the zeromq-dev
mailing list