[zeromq-dev] Edge-triggered polling vs Level-triggered. Which one ZMQ is using? Why?

Michel Pelletier pelletier.michel at gmail.com
Wed Jul 30 21:32:03 CEST 2014

On Mon, Jul 21, 2014 at 11:23 AM, Goswin von Brederlow <goswin-v-b at web.de>

> On Mon, Jul 14, 2014 at 08:42:14AM -0700, Michel Pelletier wrote:

> I think it is a big issue.
> On read a level trigger is better because when you didn't consume all
> input then the next zmq_poll() should not block. It's too easy to
> accidentally run into this. Further you actually do want to only
> consume some input from each socket and then poll again. The reason
> for that is so that you can round-robin all sockets fairly, e.g.
> consume one message from each socket and then poll again. If you
> instead consume as much as possible from every socket then one socket
> can be flooded with messages and starve other sockets. So level
> trigger on read is a must for me.

By the time you are calling poll the flood has already occurred, the data
has arrived locally and is in memory.  The polling strategy isn't a form of
flow control.  At some point something has to block or drop when you don't
consume the data that has arrived whether in one edge triggered call or
many level triggered calls.  If you're worried about flooding then credit
based flow control is the way to go.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140730/f7f9a79e/attachment.htm>

More information about the zeromq-dev mailing list