I frequently get this error on random pages when the are like ~+10K connections (netstat -an |grep 80 |wc -l). This happens while there is still +10GB of free memory and server load is less than 3.

My relevant configs:


memory_limit = 1024M
default_socket_timeout = 120


pm = dynamic 
pm.max_children = 30 
pm.start_servers = 5
pm.min_spare_servers = 2 
pm.max_spare_servers = 5 
;pm.max_requests =20000 #uncommented with any value didn't fixed
request_terminate_timeout = 120s

I also doubled the above vlues (i.e 60 children, 10 start, 10 max servers) with no avail.


worker_connections 4024;
keepalive_timeout 10;

Nginx itself behind Varnish and memcached is enable. page rendering is pretty fast in general.

This seems to be a quite common problem you I could not find any helpful solution or even analysis of the possible causes. So your hints/solutions are greatly appreciated.


Unfortunately it is difficult to give definite answer to this question without more details.

I have a couple of guesses though:

My first guess is that your php5-fpm worker socket(s) have too small listen backlog for your load. The backlog queue length is 128 by default on Linux.

To increase it you should:

  1. Increase net.core.somaxconn sysctl value.
  2. Increase listen.backlog php5-fpm configuration setting.

You could try increasing both to 2048 for example to see if that helps.

My second guess is the per process maximum open file descriptors limit of the nginx workers. The proper way to increase it depends on your distribution. On Ubuntu/Debian you should have a look in /etc/default/nginx file and worker_rlimit_nofile nginx configuration setting.

  • Do you know a way to check if it's f.e. the listen backlog that's filled up? – SimonSimCity Mar 30 '16 at 21:47

Your Answer

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

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