Centos – Apache creates lots of processes in CLOSE_WAIT state and than crashes

apache-2.2centosnetstatnetworkingPHP

I have a web server (centos) with Apache 2.4.3 and in peak times Apache becomes unresponsive until I restart it.

Before it happens there is suddenly spike of httpd proccesses count and it seems that the problem is that there are many httpd processes in CLOSE_WAIT state.

netstat -tanp | grep ':80 ' | grep httpd | awk '{print $6}' | sort | uniq -c | sort -n
      1 LISTEN
    255 ESTABLISHED
    553 CLOSE_WAIT

Do you have any idea how to solve this issue?

Best Answer

Your server probably reached its MaxClients limit. This means that you have more than 255 simultaneous clients connect to your server. The first obvious thing you can do is disable KeepAlives.

Then if you really need more worker processes you will have to change the mpm from prefork to worker, but this will not work with php.

Related Topic