multiple worker processes (problem or normal?)

Igor Sysoev igor at sysoev.ru
Wed Jun 8 07:29:48 MSD 2011


On Wed, Jun 08, 2011 at 11:07:05AM +0800, tegrof wrote:
> i think you could see the key word "[debug]", can't you ? that means it is NOT an error, just a normal case.
> u can configure nginx to use the accept mutex lock.
> these may be the case :
>  worker proccess 1:
> 1. try to get accept mutex lock, let's assume it  success to get lock, it will add the listen fd to epoll 
> 2. epoll_wait with max 500ms timer, then deal with events return from epoll_wait. 
>  worker proccess 2:
> 1. try to get accept mutex lock, let's assume it  does NOT success to get lock, it will  NOT add the listen fd to epoll 
> 2. epoll_wait with max 500ms timer, then deal with events return from epoll_wait.
>  
> accept mutex lock is useful in some system that still have thunder-herd problems, and it is said that linux does NOT have this problem now.

The thunder-herd problem is resolved at least for a case when several
processes or threads wait in accept() syscall like Apache does. Apache
has AcceptMutex for a case when it listens on several ports and has to
use select() on the ports. I'm not sure that this problem is resolved for
select/epoll. You can test in nginx debug mode using

events {
    accept_mutex off;
    ...
}


-- 
Igor Sysoev



More information about the nginx-devel mailing list