multi_accept off – A worker process accepts one new connection at a time (the default). If enabled, a worker process accepts all new connections at once. We recommend keeping the default value ( off ), unless you're sure there's a benefit to changing it.
worker_connections – The maximum number of connections that each worker process can handle simultaneously. The default is 512, but most systems have enough resources to support a larger number.
With NGINX, every open connection equates to at least one or sometimes two open files. By setting the maximum number of connections to 4096 , we are essentially defining that every worker can open up to 4096 files.
Context: http , server , and location. This directive defines the number of seconds the server will wait before closing a keep-alive connection. The second (optional) parameter is transmitted as the value of the Keep-Alive: timeout= <HTTP response header> .
worker_connections is the number of simultaneous connections; so they are simply stating how to calculate, for example:
you are only running 1 process with 512 connections, you will only be able to serve 512 clients.
If 2 processes with 512 connections each, you will be able to handle 2x512=1024 clients.
The number of connections is limited by the maximum number of open files (RLIMIT_NOFILE) on your system
nginx
has a better, updated description of worker connections.
fyi, the wiki section is considered obsolete (dont ask), now only the main nginx.org/en/docs are preferred...
Worker processes:
worker_process auto;
to automatically adjust the number of Nginx worker processes based on available cores.Worker connections:
worker_connections <no>
.ulimit -n
.max_clients = worker processes * worker connections
From Nginx's Beginner’s Guide
nginx has one master process and several worker processes. The main purpose of the master process is to read and evaluate configuration, and maintain worker processes. Worker processes do actual processing of requests. nginx employs event-based model and OS-dependent mechanisms to efficiently distribute requests among worker processes. The number of worker processes is defined in the configuration file and may be fixed for a given configuration or automatically adjusted to the number of available CPU cores
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With