[zeromq-dev] kqueue & epoll based zmq_poll

Pieter Hintjens pieterh at gmail.com
Sat Jun 11 11:23:01 CEST 2011

For the CZMQ zloop reactor, at least, we're only rebuilding the pollset when
there's a change. So that'd work nicely with epoll et al.

On 11 Jun 2011 10:02, "Martin Sustrik" <sustrik at 250bpm.com> wrote:
> On 06/11/2011 12:04 AM, Marko Mikulicic wrote:
>> Just a comment: The performance gain with epoll et al. is tied to
>> different API (only the file descriptors that are actually changed are
>> passed to and from the API). Thus implementing old-style API like
>> zmq_poll() on top of epoll doesn't make much sense.
>> this API issue is exacerbated by the fact that the system call crosses
>> the user/kernel boundary and large datastructures
>> have to be copied to kernel space and back again. It could be possible
>> to write an zmq_poll compatible implementation which detects changes in
>> the zmq_poll_items
>> arrays and applies corresponding epoll_ctl operations. The performance
>> improvement, if any, would depend on how this trick plays well with the
>> given invocation pattern of zmq_poll,
>> but it is at least plausible to expect performance benefits from it.
> Sure. Feel free to implement it. I am a bit sceptical about possible
> performance gain due to two factors:
> 1. To find out what the differences in the pollset are, zmq_poll()
> implementation would have to scan and sort the pollset which has
> complexity of O(n log n).
> 2. Users of the API would be tempted to re-create the pollset before
> each call to zmq_poll() which would destroy any benefit which could be
> possibly gained by using epoll-style mechanism underneath.
> Martin
> _______________________________________________
> 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/20110611/eafd805f/attachment.htm>

More information about the zeromq-dev mailing list