PHP-FPM WARNINGメッセージ server reached pm.max_children setting の対応

  • Posted on: 24 January 2019
  • By: admin

WARNINGメッセージ

$ sudo tail -f /var/log/php7.2-fpm.log
[01-Jan-2019 11:21:55] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
[01-Jan-2019 11:22:26] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
[01-Jan-2019 11:29:52] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it

PHP-FPM プロセス当たりの 平均使用メモリを求める。

$ ps --no-headers -o rss,cmd -C php-fpm7.2 | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }'
94M

pm.max_children = Total RAM dedicated to the web server / Max child process size = 8000MB / 100MB = 80

$ sudo vi /etc/php/7.2/fpm/php-fpm.conf
pm.max_children = 100
pm.start_servers = 60
pm.min_spare_servers = 40
pm.max_spare_servers = 80
$ sudo systemctl restart php7.2-fpm