Performance benefit of epoll over poll

Keith Packard keithp at keithp.com
Thu May 26 07:41:29 UTC 2016


epoll is designed to reduce the cost of having many file descriptors
in a process which are mostly idle. The kernel only reports data about
active descriptors.

I changed MAXCLIENTS from 512 to 2048 so I could get some 'worst case'
measurements. I figured x11perf -noop would be a nice test, and then
when I saw what the 'Sync time adjustment' was in these situations, I
wondered what x11perf -noop -sync would do and was surprised to see that
the effect was even larger. Clearly, calling poll with thousands of file
descriptors is expensive...

            -noop          	    -noop -sync
            clients	              clients
          1	505     2047      1      505     2047

epoll   53e6    53e6    53e6	140e3   140e3   140e3
poll    53e6    50e6	34e6	140e3	 12e3 	  2e3
select  43e6    43e6            140e3    12e3

So, epoll clearly wins when we have a bunch of clients, but both poll
and epoll are winning over select because we aren't sending 512 file
descriptors into the kernel for it to mull over every time we call
select.

I want to clean up the patches on my epoll branch before trying to get
them merged; there are a couple of false starts left in the branch
before I figured out the interface I wanted.

-- 
-keith
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 810 bytes
Desc: not available
URL: <https://lists.x.org/archives/xorg-devel/attachments/20160526/2953eafe/attachment.sig>


More information about the xorg-devel mailing list