php-fpm7.0スロークエリーの設定と説明
3779 ワード
環境の説明
php-fpm構成パスの表示
では、
2行構成の追加
fpmを再起動し、ディレクトリ権限などの一般的な問題に注意します.
logエコー結果の表示
ロゴの説明について
これは何の説明もありません.時間プロセスid
実行スクリプト名、php webアプリケーションはすべて単一エントリです
この3行目は重要です.スタックトップ情報(is the top of the stack trace)です.しきい値を超えた現在実行されているメソッドの関数呼び出しがどれなのか、具体的なファイルとコード行数の残りの部分が呼び出しの順序(下から上へ、最終的には遅くなるタイムアウトの結果)であることを説明します.
その他の説明
3行目が
同様に、
リファレンスリンク
php-fpm構成how-to-read-the-php-slow-request-log
root@ubuntu:/home/tb# cat /etc/issue
Ubuntu 16.04.2 LTS
\l
root@ubuntu:/home/tb# php -v
PHP 7.0.15-0ubuntu0.16.04.4 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.15-0ubuntu0.16.04.4, Copyright (c) 1999-2017, by Zend Technologies
php-fpm構成パスの表示
root@ubuntu:/home/tb# ps -ef |grep fpm
root 1642 1 0 10:17 ? 00:00:01 php-fpm: master process (/etc/php/7.0/fpm/php-fpm.conf)
www-data 3685 1642 0 17:14 ? 00:00:04 php-fpm: pool www
www-data 3686 1642 0 17:14 ? 00:00:03 php-fpm: pool www
www-data 3808 1642 0 17:43 ? 00:00:03 php-fpm: pool www
root 3930 2208 0 18:10 pts/0 00:00:00 grep --color=auto fpm
root@ubuntu:/home/tb#
php-fpm.conf
の最後の動作include=/etc/php/7.0/fpm/pool.d/*.conf
では、
www.conf
に変更して、遅いクエリーの紹介を見てみましょう.314 ; The log file for slow requests
315 ; Default Value: not set
316 ; Note: slowlog is mandatory if request_slowlog_timeout is set
317 ;slowlog = log/$pool.log.slow
318
319 ; The timeout for serving a single request after which a PHP backtrace will be
320 ; dumped to the 'slowlog' file. A value of '0s' means 'off'.
321 ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
322 ; Default Value: 0
323 ;request_slowlog_timeout = 0
2行構成の追加
slowlog=/var/log/php7.0/fpm/slow.log
request_slowlog_timeout=1s
fpmを再起動し、ディレクトリ権限などの一般的な問題に注意します.
service php7.0-fpm reload
logエコー結果の表示
[03-Jan-2018 18:48:53] [pool www] pid 4934
script_filename = /usr/share/nginx/ testapp/index.php
[0x00007fb626213520] session_start() /usr/share/nginx/ testapp/app/models/user_model.php:11
[0x00007fb6262134a0] __construct() /usr/share/nginx/ci_2.2.0/core/Loader.php:303
[0x00007fb626213390] model() /usr/share/nginx/ testapp/app/core/my_Controller.php:39
[0x00007fb6262132e0] __construct() /usr/share/nginx/ testapp/app/controllers/home.php:8
[0x00007fb626213270] __construct() /usr/share/nginx/ci_2.2.0/core/CodeIgniter.php:308
[0x00007fb6262130e0] [INCLUDE_OR_EVAL]() /usr/share/nginx/ testapp/index.php:325
[03-Jan-2018 18:48:53] [pool www] pid 4931
script_filename = /usr/share/nginx/ testapp/index.php
[0x00007fb626213520] session_start() /usr/share/nginx/ testapp/app/models/user_model.php:11
[0x00007fb6262134a0] __construct() /usr/share/nginx/ci_2.2.0/core/Loader.php:303
[0x00007fb626213390] model() /usr/share/nginx/ testapp/app/core/my_Controller.php:39
[0x00007fb6262132e0] __construct() /usr/share/nginx/ testapp/app/controllers/home.php:8
[0x00007fb626213270] __construct() /usr/share/nginx/ci_2.2.0/core/CodeIgniter.php:308
[0x00007fb6262130e0] [INCLUDE_OR_EVAL]() /usr/share/nginx/ testapp/index.php:325
ロゴの説明について
[03-Jan-2018 18:48:53] [pool www] pid 4931
これは何の説明もありません.時間プロセスid
script_filename = /usr/share/nginx/ testapp/index.php
実行スクリプト名、php webアプリケーションはすべて単一エントリです
[0x00007fb626213520] session_start() /usr/share/nginx/ testapp/app/models/user_model.php:11
この3行目は重要です.スタックトップ情報(is the top of the stack trace)です.しきい値を超えた現在実行されているメソッドの関数呼び出しがどれなのか、具体的なファイルとコード行数の残りの部分が呼び出しの順序(下から上へ、最終的には遅くなるタイムアウトの結果)であることを説明します.
その他の説明
3行目が
curl_exec()
のように見える場合、例えば、これは一般的にネットワークioが時間を消費している場合、第三者に要求しなければならない場合.我慢しろ.[0x00007fb6262136f0] curl_exec() /usr/share/nginx/
同様に、
mysql_query
などがある場合も、sql
の遅いクエリによるものです.リファレンスリンク
php-fpm構成how-to-read-the-php-slow-request-log