There is always only one worker process in nginx to handle listen fd, in epoll. Why?

in order to avoid group problems, only one worker process is used to listen, and it is controlled by accept_mutex (the current version seems to have a new processing method turned off by default, so let"s just say I"m talking about turning on the old version of accept_mutex), but is there any difference between this and directly dealing with the main process? How to take advantage of multi-core advantage? All I can think of is that a worker will not all break down, just a little bit more robust, but from the beginning to the end, there is only one worker dealing with all the monitoring. (the last one who got the lock will hand over all the fd),. In my opinion, it just enhances the robustness. Many people on the Internet say that they have improved concurrency and made use of multi-core advantages. How should I understand it?.


is actually a matter of personal understanding. Just use a worker to listen to sockets. If you use multi-threaded worker to listen to connection sockets, you will naturally take advantage of multi-core advantages


to understand a concept that threads can be executed in parallel under multi-cores. For example, your cpu is 4 cores, and you can execute one thread on each core at the same time. Is it true that 4 threads operate in parallel? The number of
worker is set to the number of cpu cores in order to take full advantage of this number of cores, because a worker process will only run one worker thread.

Menu