Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 15 down vote accepted

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;
share|improve this answer
Can you describe what "worker_rlimit_nofile 8192" is used for? – The Pixel Developer Jun 10 '09 at 16:57 This instructs the worker to increase its ulimit. – Dave Cheney Jun 10 '09 at 17:53

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.

share|improve this answer

I'd start with one and add later if it appears to be a problem.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.