Problem:

The following warning message appears in the logs:

It means that there are not enough PHP-FPM processes.

Solution:

We need to calculate and change these values based on the amount of memory on the system:

/etc/php-fpm.d/www.conf

– the following command will help us to determine the memory used by each (PHP-FPM) child process:

The RSS column shows non-swapped physical memory usage by PHP-FPM processes in kilo Bytes.

On an average each PHP-FPM process took ~75MB of RAM on my machine.

Appropriate value for pm.max_children can be calculated as:

pm.max_children = Total RAM dedicated to the web server / Max child process size – in my case it was 85MB

The server has 8GB of RAM, so:

pm.max_children = 6144MB / 85MB = 72

I left some memory for the system to breath. You need to take into account any other services running on the machine while calculating memory usage.

I’ve changed the settings as follow:

Please note that very high values does not mean necessarily anything good.

You can check an average memory usage by single PHP-FPM process with this handy command:

You can use the same steps above to calculate the value for MaxClients for Apche web server – just substitute the php-fpm with httpd.

Refer: https://myshell.co.uk/blog/2012/07/adjusting-child-processes-for-php-fpm-nginx/

分类: NGINXPHP

0 条评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据