[Libevent-users] Two questions...
Niels Provos
provos at citi.umich.edu
Thu Nov 29 11:04:55 EST 2007
On Nov 5, 2007 11:52 AM, arthur <mail2arthur at gmail.com> wrote:
> 2. one process (I didn't use thread) can only have a limited number of
> fd's -> fork multiple processes to more accept client connection
Some event backends do not deal with fork, for example, kqueue file
descriptors do not surive across a fork. This used to be a problem
in libevent, however, both trunk and the 1.4 branch now support an
event_reinit() method that can be used to reinitalize the event base
after a fork.
However, I am really surprised that you are using a fork model because
you are hitting file descriptor limits. Linux and the *BSDs have no
problems dealing with > 50k file descriptors. Furthermore, accept()
used to have a "thundering herd" problem (see
http://www.citi.umich.edu/projects/linux-scalability/reports/accept.html)
which has been fixed on Linux, but I don't know if that's true for
other operating systems. You might be better off with a
multi-threaded solution.
Niels.
More information about the Libevent-users
mailing list