0

Even how high I set the pm.start_servers, or pm.min/max_spare_servers, I always get this error when PHP-FPM reach the limit:

WARNING: [pool web8] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 31 idle, and 62 total children

I noticed that when I reload php-fpm most often, I never seen this kind of error. This is also supported by this blog.

My question is if it is okay to reload php-fpm every 9 minutes or whatever interval you set.

Update:

Here's my current configuration of my two website with highest traffic (each website is running a separate pool):

pm.max_children = 256
pm.start_servers = 50
pm.min_spare_servers = 40
pm.max_spare_servers = 192
pm.max_requests = 500

And I also execute this command when the memory used reaches 90%:

/sbin/sysctl -w vm.drop_caches=3

After the command is executed, the memory used is back to 30%. I don't know if this is another bad idea. I do this because if not, the memory is rising up to 100% and it uses swap.

I'm running the following specs:

Single Processors: WHT Xeon E3-1270 v2
32 GB RAM

1 Answer 1

0

No, it's not OK to "gracefully" reload PHP every N minutes.

What he doesn't tell you (and may not even know himself) is that while php-fpm is reloading, it will refuse incoming connections for a small fraction of a second. Users who hit your web site during this interval will get a 502 Bad Gateway error from nginx.

Furthermore, it's not even really necessary to do this when pm.max_requests is set to a reasonably low value, as the children will be automatically recycled.


To resolve your seems busy problem, you simply need to tune the php-fpm pool correctly. You have a large number of idle servers but it's spawning more, which indicates to me that one of pm.min_spare_servers or pm.max_spare_servers or both are set too high. Try reducing them.

1
  • Thank you for the reply. I updated my question so you will see my current configuration. Can you tell me if it is okay?
    – jaYPabs
    Jan 12, 2014 at 7:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .