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.
Best Answer
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 increaseworker_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.