Nginx worker_processes configuration and recommendations

From the many posts around the Internet and our own experience worker_processes value is recommended to be set to the number of cores your server has.
For example, if you have two dual core CPU you should set worker_processes 4;

Original worker_processes help from Nginx page:

worker_processes 4;

nginx has the ability to use more than one worker process for several reasons:

1. to use SMP
2. to decrease latency when workers blockend on disk I/O
3. to limit number of connections per process when select()/poll() is used

The worker_processes and worker_connections from the event sections allows you to calculate maxclients value:

max_clients = worker_processes * worker_connections


Leave a Reply