Php-fpm requests eventually goes to queue !!

Reinis Rozitis r at roze.lv
Thu May 22 14:52:44 UTC 2014


> pm.max_children = 250
> pm.start_servers = 40
> pm.max_requests = 40000

> Any clue why requests are still getting into php-fpm  queue and max 
> children also reached errors occuring, even max_children are 250 * 40000. 
> ??


Your math is wrong - there is no such 250 * 40000, because pm.max_requests 
is just a number of requests after which the php child restarts (to avoid 
possible memory leak etc (it may also be 0)).

Your (maximum simultaneously running) concurrent requests are still 250 
(~pm.max_children), so bassically if your request takes longer than 1 second 
and there are more than 250 requests per second you will end up with a 
queue.


You either speed up the php code (and everything besides it) / increase the 
FPM pool (more children or more pools/fpm backends) or use caching like some 
frontend cache (varnish/squid etc) or nginx with fastcgi_cache.

rr





More information about the nginx mailing list