Use epoll instead of select on linux

ardeujho ardeujho at cd.pn
Fri Feb 21 01:17:21 UTC 2014


ardeujho <ardeujho at cd.pn> writes:

> Epoll has better performance than select when there is a large number of
> open files and does not have the 1,024 file descriptor limit.

I've made a change to the pull request to account for the fact that
epoll doesn't work on regular files. Attempting to do an epoll_ctl on
these results in an EPERM error.

I've worked around this by keeping a set of file descriptors that
produce this error and automatically adding these to the result of a
select call from Self as being readable and writable.

Longer term it might be worthwhile investigating how to get asynchronous
i/o working with regular files on Linux to improve performance in i/o
bound apps.

In the meantime the workaround means that there is a limit of 1024 open
regular files but no limit to the number of sockets and other similar
file types.



More information about the Self-interest mailing list