While working on upgrading to PHP 5.5 I've faced a problem with php-fpm.
I've created a new web node with the new PHP version and I'm signing it in on the load balancer to test it in prod. Everything works out fine until a lot of php-fpm processes gets stuck out of sudden (after ~1 hour). Hereafter I receives timeouts.
I've changed distribution from Debian to Ubuntu and upgraded to PHP 5.5. Besides that the new server is the same as before (when everything worked/works).
I've tried signing in two new web nodes and they will get stuck at the same time. I think it can be related to sudden slow responses from database (since that's the only thing they share).
However, I would like php-fpm not to crash, so it will work when database is OK again.
To fix it now I can restart php-fpm service but that's not a solid plan.
ps aux | grep php
shows me:
root 13919 0.0 0.4 423472 19736 ? Ss Dec08 0:10 php-fpm: master process (/etc/php5/fpm/php-fpm.conf)
www-data 14087 0.0 3.1 474972 127284 ? S Dec08 0:54 php-fpm: pool www
www-data 14088 0.0 2.3 446944 94956 ? S Dec08 0:50 php-fpm: pool www
www-data 14089 0.1 2.2 443816 92644 ? S Dec08 1:03 php-fpm: pool www
www-data 14090 0.0 3.0 474208 124716 ? S Dec08 0:44 php-fpm: pool www
www-data 14092 0.0 3.1 478284 129060 ? S Dec08 0:41 php-fpm: pool www
www-data 14099 0.0 2.5 459700 105224 ? S Dec08 0:14 php-fpm: pool www
www-data 14111 0.0 2.0 439876 84952 ? S Dec08 0:06 php-fpm: pool www
www-data 14114 0.0 0.4 427220 18472 ? S Dec08 0:00 php-fpm: pool www
www-data 14115 0.0 0.4 427220 18380 ? S Dec08 0:00 php-fpm: pool www
www-data 14116 0.0 0.4 427184 18936 ? S Dec08 0:00 php-fpm: pool www
www-data 14117 0.0 0.4 427204 18904 ? S Dec08 0:00 php-fpm: pool www
www-data 14118 0.0 0.4 427220 18372 ? S Dec08 0:00 php-fpm: pool www
www-data 14119 0.0 0.4 427184 18832 ? S Dec08 0:00 php-fpm: pool www
www-data 14120 0.0 0.4 427188 18960 ? S Dec08 0:00 php-fpm: pool www
www-data 14121 0.0 0.4 427220 18384 ? S Dec08 0:00 php-fpm: pool www
www-data 14122 0.0 0.4 427200 18932 ? S Dec08 0:00 php-fpm: pool www
www-data 14123 0.0 0.4 427236 18488 ? S Dec08 0:00 php-fpm: pool www
www-data 14124 0.0 0.4 427220 18392 ? S Dec08 0:00 php-fpm: pool www
www-data 14125 0.0 0.4 427220 18384 ? S Dec08 0:00 php-fpm: pool www
www-data 14126 0.0 0.4 427204 18820 ? S Dec08 0:00 php-fpm: pool www
www-data 14127 0.0 0.4 427220 18484 ? S Dec08 0:00 php-fpm: pool www
www-data 14128 0.0 0.4 427204 18920 ? S Dec08 0:00 php-fpm: pool www
www-data 14129 0.0 0.4 427188 18904 ? S Dec08 0:00 php-fpm: pool www
www-data 14130 0.0 0.4 427220 18372 ? S Dec08 0:00 php-fpm: pool www
www-data 14131 0.0 0.4 427188 18920 ? S Dec08 0:00 php-fpm: pool www
www-data 14132 0.0 0.4 427220 18372 ? S Dec08 0:00 php-fpm: pool www
www-data 14133 0.0 0.4 427204 18936 ? S Dec08 0:00 php-fpm: pool www
www-data 14134 0.0 0.4 427220 18388 ? S Dec08 0:00 php-fpm: pool www
www-data 14135 0.0 0.4 427220 18368 ? S Dec08 0:00 php-fpm: pool www
www-data 14136 0.0 0.4 427184 18936 ? S Dec08 0:00 php-fpm: pool www
As you can see 24 processes has been running for 0 seconds (htop tells me it's around 2ms). They will stay like that forever. All of them appeared at the same time.
My config:
pid = /var/run/php5-fpm.pid
error_log = /var/log/php5-fpm.log
log_level = debug
user = www-data
group = www-data
listen = 127.0.0.1:9000
pm = dynamic
pm.max_children = 30
pm.start_servers = 5
pm.min_spare_servers = 3
pm.max_spare_servers = 7
pm.max_requests = 500
Also, I never see anything in the php-fpm.log (just NOTICE: configuration file /etc/php5/fpm/php-fpm.conf test is successful
)
Anybody?
EDIT:
I have tried running both ondemand
and dynamic
process manager