We have PHP FPM with Apache running Wordpress. Occasionally I have noticed certain plugins that call external URLs have the ability to really mess with FPM resulting in lots of timeouts etc if the external URL is not responding or something. We never had this problem run mod_php. Is there something I can do about this to make PHP FPM work better in these situations?


Not really. When a php-fpm child is executing a code referring to an external URL, and that URL doesn't answer [in time], the code blocks for some configured timeout (for example curl connect timeout), so the child blocks and waits too, unable to serve the php-fpm socket. When all the children enter that state, you get a 504 status on your site. By the way, so is the behaviour of the apache mod_php too. So this is basically a programming problem, you should discuss it in the SO, not in SF.

The only thing you can do in the SF context - is increasing the number of children in the php-fpm pool, but this is generally counter-productive, as the others will sooner or later block on this URL too. The only thing that can save you without modifying the code - is having more free children than you have users connected to your web-servers. But this is a way full of sadness and frustration.

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.