My site recently got lots and lots of traffic and I think the issue was the nginx was spending too much time scheduling requests. I increased my worker_processes and that seemed to fix the problem.

Honestly, I do not really understand why.

I was wondering if someone could point me to/explain how nginx workers work, and what the worker_rlimit_nofile is, so I could have a better conceptual understanding for future changes I have to make.


In nginx worker_processes are the number of processes nginx will spawn. Default is 1 , worker_rlimit_nofile is the maximum file descriptors that can be opened by each worker process. Be careful when you increase worker_processes, because this will impact in the number of max. clients your server will handle. worker_processes values of 2 or 4 are ok when working on multiprocessor machines.

Also you can change the worker_connections parameter which is the maximun number of connections for each worker process.

It seems that in your case the number of requests was serving a big number of request per second and the default nginx worker was spending too much time blocked on disk IO.


I'm not familiar with nginx, but to get you started some general *nix daemon information:

nofile tends to be The max number of open files (File Descriptors) resource limit for a process. So that is probably how many files can be opened by each worker (files includes sockets). See ulimit and /etc/security/limits.conf .

Many daemons have a process that spawns new processes to respond to requests. So by increasing the number of workers, you are maybe making it so the processes are already spawned and ready to answer questions requests.

  • Had to keep my mistake at the end of the last paragraph:-) – Kyle Brandt Dec 9 '09 at 20:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy