3 ms·
I'm not sure about nginx, but the traditional way to share a listen port is to listen on the port, and then fork. This shares the socket with the child, and if
by toast0 5y ago
I'm not sure about nginx, but the traditional way to share a listen port is to listen on the port, and then fork. This shares the socket with the child, and if you fork several workers, they can all accept on that socket, and the OS will figure out which one wins (which may or may not be round robin). You can select/kqueue/epoll/whatever if you prefer, as well.
- jhugo 5y agoYes, this is how nginx does it; whether it sets SO_REUSEPORT can be configured.