On Sat, May 02, 2009 at 06:50:25PM +0200, Chris Wan wrote:
I want to know more information about this directives.
allows only one worker to get new connections notification and to call
accept(). You can switch accept_mutex off, then all scheduling will be
done by OS scheduler via accept() call. "
but apache said:
/* On some architectures it’s safe to do unserialized accept()s in the
- Listen case. But it’s never safe to do it in the case where there’s
- multiple Listen statements. Define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
- when it’s safe in the single Listen case.
If Listen is single Apache workers just call blocking accept().
If Listen are several worker can not just call blocking accept() on one
listening socket. It calls select() for all listening sockets instead,
and then calls accept() for returned socket.
nginx workers always use select/kqueue/epoll/etc. before accept().
OS may wake all processes waiting on accept() and select(), this is
This is a problem if you have a lot of workers as in Apache (hundreds
and more), but this insensible if you have just several workers as nginx
usually has. Therefore turning accept_mutex off is as scheduling
connection by OS via select/kqueue/epoll/etc (but not accept().