Previously found Nginx process in the task allocation is very uneven, that a process once busy will be busy for a long time, while the idle thread has been idle, followed by the code found in epoll_wait default timer is 500ms (without a task), can be reduced by accept_ Mutex_delay This parameter gives the idle process a greater chance to grab the accept lock, thus making the task more evenly distributed, and the impact on efficiency that needs to be tested to know.
Worker process if you want to grab a lock, you must wake up from the epoll_wait to go through the circulation process, and then go to the place to grab the lock to seize the opportunity, and once the worker process grabbed the accept lock, the task is more than the case, Epoll_ Wait will be frequently activated, resulting in a huge increase in the chance of the lock, and the idle process 500ms to try to grab the accept lock, so the larger the request volume, the less likely the idle process to grab the lock.
Lock process:
1. Grab Lock
2. Add listen fd to Epoll event
3, Unlock (if not unlocked, that other process will never have the opportunity to accept again)
Accept_mutex_delay
Meaning: Sets the minimum delay time to obtain a mutex.
Syntax: Accpet_mutex_delay <number of Millisecs>
Default: 500ms
Example: Accpet_mutex_delay 1000ms;
Small Talk about Accpet_mutex_delay parameters