受託会社のCTOのメモ

チラシの裏

bitnamiでwordpressが落ちる時のMySQL php-fpm周りのチューニングメモ

ログ内容

[26-Sep-2019 12:59:26] WARNING: [pool wordpress] server reached pm.max_children setting (5), consider raising it
[26-Sep-2019 13:00:55] WARNING: [pool wordpress] server reached pm.max_children setting (5), consider raising it
[26-Sep-2019 14:04:56] WARNING: [pool wordpress] server reached pm.max_children setting (5), consider raising it
[26-Sep-2019 21:29:14] WARNING: [pool wordpress] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 2 idle, and 16 total children
[26-Sep-2019 21:29:15] WARNING: [pool wordpress] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 16 children, there are 3 idle, and 18 total children
[26-Sep-2019 21:29:16] WARNING: [pool wordpress] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 1 idle, and 19 total children
[26-Sep-2019 21:30:50] WARNING: [pool wordpress] server reached pm.max_children setting (25), consider raising it

エラーログの場所

$ /opt/bitnami/php/var/log/php-fpm.log
$ /opt/bitnami/mysql/data/mysqld.log
$ /var/log/syslog

設定ファイル

$ /opt/bitnami/php/etc/php.ini 
$ /opt/bitnami/apps/wordpress/conf/php-fpm/php-settings.conf
$ /opt/bitnami/php/etc/php-fpm.conf
$ /opt/bitnami/mysql/bitnami/my.conf

再起動コマンド

$ sudo /opt/bitnami/ctlscript.sh restart apache
$ sudo /opt/bitnami/ctlscript.sh restart php-fpm
$ sudo /opt/bitnami/ctlscript.sh restart mysql

確認コマンド

$ free
$ free -g
$ top #負荷平均わかる

プロセス数確認

$ ps -ef | grep 'php-fpm: pool' | wc -l

$ ps ax | grep mysql

負荷テスト

$ ab -n 100 -c 100 http://3.113.234.85.xip.io/

n : リクエストの総数を数値で指定 c : 同時に発行するリクエストの数を数値で指定

参考サイト

docs.bitnami.com

yakst.com