nginx Learning (Four): nginx web request processing mechanism

worker preemption mechanism

, If there is a request, the process will work for each lock contention below. Who's who grabbed Yes. It should be noted that all key Nginx worker processes work together (shared memory).

[Accept_mutex introduction]

When a new connection arrives, if activated accept_mutex, then multiple Worker will be processed serially, one of which will be awakened Worker, Worker others remain dormant; if not active accept_mutex, then all will Worker wake up, but only a Worker can get a new connection, other Worker will re-enter a dormant state, which is the "thundering herd problem."

Asynchronous non-blocking

nginx is asynchronous non-blocking

In Linux, Nginx using I / O multiplexing model of epoll

config file

events {
   # 默认使用epoll
   use epoll;
   # 每个worker允许连接的最大数
   worker_connections  1024;
}

Guess you like

Origin www.cnblogs.com/zhenghengbin/p/12077798.html