Solved php-fpm: WARNING: [pool www] seems busy…


The root cause of your problem can’t be determined because we don’t know what kind of code your server runs.

What happens is that PHP can’t process requests fast enough to keep up with nginx.

Raising number of child processes won’t help, you have 16 cores and 20 processes. This means that your OS will be forced to schedule processes and raising the number won’t make anything faster – you don’t even know if you are CPU or I/O bound.

To correctly solve this problem, you need to determine why PHP can’t keep up.

You can enable PHP-FPM slow_log feature by adding this to your pool:

slowlog = /var/log/php-fpm/slow.log
request_slowlog_timeout = 5

This will log every request that took 5 second or longer to file /var/log/php-fpm/slow.log

Inspect the log file and trace back which part of your code causes PHP to respond slowly and fix the real problem


To keep your site responsive until you fix the real problem is that you get another server for PHP processing. Since you are using nginx and php-fpm is your backend, then it’s quite trivial to set up more servers to handle dynamic request processing. As your site grows and demands grow with it, you can easily add more backend processing power by adding php-fpm serves to processing pool.

Disclaimer: I am not saying that you should but it’s good to know what your options are.

So, it’s ok:

[20-Apr-2017 11:19:23] NOTICE: child 8271 stopped for tracing
[20-Apr-2017 11:19:23] NOTICE: about to trace 8271
[20-Apr-2017 11:19:23] NOTICE: finished trace of 8271
[20-Apr-2017 11:19:23] NOTICE: child 1752 stopped for tracing
[20-Apr-2017 11:19:23] NOTICE: about to trace 1752
[20-Apr-2017 11:19:23] NOTICE: finished trace of 1752
[20-Apr-2017 11:19:23] NOTICE: child 1758 stopped for tracing
[20-Apr-2017 11:19:23] NOTICE: about to trace 1758
[20-Apr-2017 11:19:23] NOTICE: finished trace of 1758
[20-Apr-2017 11:19:23] NOTICE: child 26247 stopped for tracing
[20-Apr-2017 11:19:23] NOTICE: about to trace 26247

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s