I'm setting up nginx to serve a Drupal install, and I seem to find conflicting information on the nginx worker processes setting. One site says you need two, one says you need five, one says one per processor...

How should I pick the number of nginx worker processes? If it makes a difference, it's a guest VM on a VMWare cluster, and I've given it one virtual processor.

2 Answers 2


Nginx unlike Apache and other process per connection webservers. It uses one master process to start and monitor a small number of worker processes that actually handle the connections. My recommendation is to start with the default number of workers, which is 1.

worker_processes  1;

You will only need to increase this if you find that the nginx worker is spending too much time blocked on IO. This will not by until it is serving many hundreds of requests per second.

You may also find these settings useful.

worker_rlimit_nofile 8192;

events {
    worker_connections  2048;
    use epoll;

On SMP systems, at least nCPU worker processes should be started: on quad-core - four etc. That's enougth for proxying.

If you are going to serve some sites with alot of static content, it would be better to add more workers - one per disk.

If your disk subsystem is to poor or load too high, nginx worker processes may become locked on I/O operations and could not serve other requests. In this case you should increase number of worker processes to some suitable value (may be tens), or add some memory for disk cache.

Look into "ps ax" printout: workers that are in "D" state are locked. Increase until get at least nCPU worker processes not blocked.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .