Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 0 down vote accepted

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.

share|improve this answer

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.

share|improve this answer
    
Had to keep my mistake at the end of the last paragraph:-) –  Kyle Brandt Dec 9 '09 at 20:28

Your Answer

 
discard

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