Very odd epoll_ctl calls in mail proxy

Robert Mueller robm at fastmail.fm
Tue Nov 8 22:54:32 UTC 2011


> It seems you have about 170 listen directives.

Indeed we do! Add together ipv4 + ipv6 + a failover ips + a number of
alternative ports and configurations, and it does add up!

> This is probably caused by accept_mutex. Try
> 
> events {
>      accept_mutex  off;
>      ...
> }
> 
> Probably it's better to disable accept_mutex by default.

Ah right, makes sense, I've gone and added that.

Not sure if it's an issue, but an alternative would be to create a
separate "accepting" fd, add all the listening fd's to that one, and
only add/remove that fd from the main polling set when you have the
mutex.

That at least should work for epoll, which says:

Q3  Is the epoll file descriptor itself poll/epoll/selectable?
A3  Yes.  If an epoll file descriptor has events waiting then it will
indicate as being readable.

Not sure if it's worth it though, given you can just turn off the accept
mutex, and apparently linux no longer has a thundering herd issue:

http://stackoverflow.com/questions/2213779/does-the-thundering-herd-problem-exist-on-linux-anymore

I'd like to see an LKML post about that though...

Rob



More information about the nginx-devel mailing list