accpet_mutex cause nginx worker balance problem
xinghua_hi
nginx-forum at nginx.us
Mon Aug 4 02:47:26 UTC 2014
hello,
I still can't understand why accept_mutex cause disbalance. In code
below, multi worker will try to get mutex and the question is , why one
worker can always get the mutex ? I test many times, find that one worker
can always accept new connection much more than others. Thanks very much.
if (ngx_use_accept_mutex) {
if (ngx_accept_disabled > 0) {
ngx_accept_disabled--;
} else {
if (ngx_trylock_accept_mutex(cycle) == NGX_ERROR) {
return;
}
if (ngx_accept_mutex_held) {
flags |= NGX_POST_EVENTS;
} else {
if (timer == NGX_TIMER_INFINITE
|| timer > ngx_accept_mutex_delay)
{
timer = ngx_accept_mutex_delay;
}
}
}
}
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,252241,252254#msg-252254
More information about the nginx
mailing list