DBus and epoll

Rémi Denis-Courmont remi at remlab.net
Mon Oct 25 04:05:26 PDT 2010


On Mon, 25 Oct 2010 12:29:41 +0200, <anttu.t.koski at nokia.com> wrote:
> Is there some reason why DBus isn't using epoll instead of poll?

DBus is not using a particular I/O multiplexing function. It's up to the
application, or more commonly the underlying framework (Qt, gtk...) to
register the appropriate callbacks to each DBus connection and run the main
loop.

As far as I know, if you use libdbus' own event handler, then there should
be only one file descriptor at a time. Then epoll is actually slower than
poll() due as it incurs more context switches. Besides, epoll is not
portable.

> In my testing with around 350 file descriptors it seems that almost 3/4
of
> the time in DBus functions is spent in polling. If I run the test when
> there is only a couple of fds present, the latencies drop by about 50%. I
> guess that when there are thousands of descriptors, the latencies are
> already huge. Epoll should scale much better.

I wonder how the heck you got to 350 file descriptors with DBus to begin
with. But in any case, poll() is probably _not_ called by libdbus in this
case.

-- 
Rémi Denis-Courmont
http://www.remlab.net
http://fi.linkedin.com/in/remidenis



More information about the dbus mailing list