


Analysis of php performance analysis of php-fpm slow execution log slow log usage
Jul 21, 2020 pm 05:21 PMThe example in this article describes the usage of slow log of php-fpm slow execution log for php performance analysis. Share it with everyone for your reference, the details are as follows:
As we all know, mysql has slow query log. According to the slow query log, we can know which SQL statements have performance problems. As a good partner of mysql, php also has such a function. If you use php-fpm to manage php, you can enable it through the following options.
The settings before PHP 5.3.3 are as follows:
<value name="request_slowlog_timeout">5s</value> <value name="slowlog">logs/php-fpm-slowlog.log</value>
The settings after PHP 5.3.3 are as follows:
request_slowlog_timeout = 5s slowlog = /usr/local/php/log/php-fpm-slowlog.log
Instructions:
request_slowlog_timeout is how long it takes for the script to be recorded to the log file
slowlog is the path of the log file
After it is turned on, if a script is executed for more than the specified time, it will be written in the specified log file Enter information similar to the following:
[19-Dec-2013 16:54:49] [pool www] pid 18575
script_filename = /home/admin/web/htdocs/sandbox_canglong/test /tt.php
[0x0000000003a00dc8] curl_exec() /home/admin/web/htdocs/sandbox_canglong/test/tt.php:2
[0x0000000003a00cd0] exfilter_curl_get() /home/admin/web/htdocs/sandbox_canglong /test/tt.php:6
Log description:
script_filename is the entry file
curl_exec(): Description is when this method is executed exceeds the execution time.
exfilter_curl_get(): Description The method of calling curl_exec() is exfilter_curl_get().
The number after the colon on each line is the line number.
After it is turned on, there are also relevant records in the error log file. As follows:
[19-Dec-2013 15:55:37] WARNING: [pool www] child 18575, script '/home/admin/web/htdocs/sandbox_canglong/test/tt.php ' (request: "GET /test/tt.php") executing too slow (1.006222 sec), logging
[19-Dec-2013 15:55:37] NOTICE: child 18575 stopped for tracing
[19 -Dec-2013 15:55:37] NOTICE: about to trace 18575
[19-Dec-2013 15:55:37] NOTICE: finished trace of 18575
related Learning recommendations: PHP programming from entry to proficiency
The above is the detailed content of Analysis of php performance analysis of php-fpm slow execution log slow log usage. For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian

How To Set Up Visual Studio Code (VS Code) for PHP Development
