[zeromq-dev] Hint/Example to use zmq socket in an asynchronous loop like epoll?
Steven McCoy
steven.mccoy at miru.hk
Wed Jan 27 13:41:27 CET 2010
2010/1/22 Martin Sustrik <sustrik at 250bpm.com>
> Jianhua Cao wrote:
> > Isn't zmq_poll the zmq centric way in the sense that the even loop has
> > to be built with zmq_poll to block?
> > I am thinking to integrate zmq (played as client role) to an existing
> > async web frame work like tornado.
> > One way I was thinking is to extract fd from zmq socket object. But that
> > seems to be a wrong approach.
>
> The problem is that a single 0MQ socket can handle thousands of
> connections, each with its own fd. Moreover the polling logic is more
> complex than just checking whether there's anything to read from the
> socket (think of message queueing, message filtering etc.) Thus
> "extracting the fd" approach won't work.
>
> It certainly would be nice to have non-0MQ-centric way to do polling,
> like using 0MQ socket handles directly by select/poll/epoll functions,
> unfortunately, POSIX doesn't define any hook-up point for polling.
>
> Yes, eventfd is getting close, but it's Linux-specific and it still
> lacks ability to signal bot IN and OUT simultaneously.
>
>
As evidence you can look at how OpenPGM notifications occur, it's a smaller
controlled environment compared with the scope of ZeroMQ. It has the
requirements to signal incoming and outgoing ready events from it's state
and rate control engines and this has to be implemented using a set of
pipes, socketpairs, or eventfds. It ends up complicated, and can easily
escalate in complexity when you want to choose between level and edge based
event generation.
--
Steve-o
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20100127/fd2607fb/attachment.htm>
More information about the zeromq-dev
mailing list