what is worker_processes and worker_connections in Nginx?

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:

    • Nginx worker process that handles the incoming request.
    • Set this to worker_process auto; to automatically adjust the number of Nginx worker processes based on available cores.
    • This can go beyond the available cores if you have IO access.
  • Worker connections:

    • Each worker process can open by default 512 connections.
    • You can change this limit by worker_connections <no>.
    • You can set this to max limit ulimit -n.
    • hence,

    max_clients = worker processes * worker connections

Tags:

Nginx