Nginx Worker Tuning
On high traffic servers running Nginx, you will want to ensure the proper number of processes are available for the requests. This can be fine tuned in the nginx.conf configuration file via both worker_processes and worker_connections.
# grep worker /etc/nginx/nginx.conf
The number of NGINX worker processes (the default is 1). In most cases, running one worker process per CPU core works well. There are times when you may want to increase this number, such as when the worker processes have to do a lot of disk I/O.
The maximum number of connections that each worker process can handle simultaneously. The default is 512, but most systems have enough resources to support a larger number. The appropriate setting depends on the size of the server and the nature of the traffic, and can be discovered through testing.
Maximum Connections = worker_processes * worker_connections.
Both of these values multiplied result in the maximum number of concurrent connections. Its important to keep in mind that each connection will require a file handler, and two if the connection is proxied, so you will need to verify the open file limit. You will find errors in the Nginx log if you hit the open file limit.
The Nginx configuration option worker_rlimit_nofile sets the value for the maximum file descriptors that can be opened by a single worker process. If you don't set the worker_rlimit_nofile directive, then the OS settings will determine how many FDs can be used by Nginx. One method of changing the FD limit for Nginx is to change the values in the OS.