もくじ
PHP-FPM
プロセス数変更
staticにしちゃって良い
# vi /etc/php/7.2/fpm/pool.d/www.conf ;pm = dynamic pm = static ←●追加 ; The number of child processes to be created when pm is set to 'static' and the ; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. ; This value sets the limit on the number of simultaneous requests that will be ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP ; CGI. The below defaults are based on a server without much resources. Don't ; forget to tweak pm.* to fit your needs. ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' ; Note: This value is mandatory. ;pm.max_children = 13 pm.max_children = 50 ←●追加
タイムアウト対応
PHP-FPM
# vi /etc/php/7.2/fpm/pool.d/www.conf request_terminate_timeout = 300
$ sudo service php7.2-fpm restart $ sudo service php7.2-fpm status
Nginx
/etc/nginx/sites-available/nginx.conf server { ・・・ fastcgi_read_timeout 300; ←●追加 fastcgi_send_timeout 300; ←●追加
●RDS
wait_timeoutを300に変更
●php.ini
$ vi /etc/php/7.2/fpm/php.ini max_execution_time = 30s
$ service php7.2-fpm restart
PHP-FPMスロウログ
■ RDSのパケット閾値制限エラーの対応
カスタムパラメータグループから、
デフォルト4Mを100MBに変更
max_allowed_packetを104857600 // 100M
■TCPセッションエラー対応
# vi /etc/php/7.2/fpm/pool.d/www.conf listen.backlog = -1
$ service php7.2-fpm restart
# vi /etc/sysctl.conf net.ipv4.tcp_max_syn_backlog = 2048 net.core.somaxconn=2048
反映
$ sysctl -p