2012年6月4日月曜日

timeoutあれこれ

環境: nginx+php-fpm+WordPress 検索系の時間がかかるphpを実行すると、処理が途中で中断されている。 php-fpmのerror.logに以下のメッセージが出力されている。
[05-Feb-2012 14:06:49] WARNING: [pool www] child 29844, script '/var/www/html/blog/wp-content/themes/lumiukko/search_mall.php' (request: "GET /wp-content/themes/lumiukko/search_mall.php") execution timed out (31.332332 sec), terminating
この時の各設定は以下の通りです。 /etc/php.ini
; Maximum execution time of each script, in seconds
; http://www.php.net/manual/en/info.configuration.php#ini.max-execution-time
max_execution_time = 30
このmax_execution_timeは無関係っぽい。 /etc/php-fpm.d/www.conf
request_terminate_timeout = 30
request_slowlog_timeout = 25
slowlog = /var/log/php-fpm/www-slow.log
両方を300に再設定すると、今度は60秒くらいで中断されている。 nginxのタイムアウトのようです。 fastcgi_read_timeoutのデフォルト値が60秒となっており、これを明示的に長くすることで60秒で中断されなくなりました。 nginx.conf
fastcgi_read_timeout 300;

0 件のコメント:

コメントを投稿