PHP performance analysis: usage of php-fpm slow execution log slow log

墨辰丷
Release: 2023-03-28 18:06:02
Original
3589 people have browsed it

This article mainly introduces the usage of php-fpm slow execution log of php performance analysis. It analyzes the function and related usage skills of php slow execution log in the form of examples. Friends in need can refer to it

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>
Copy after login


The settings after PHP 5.3.3 are as follows :


request_slowlog_timeout = 5s
slowlog = /usr/local/php/log/php-fpm-slowlog.log
Copy after login


Description:

request_slowlog_timeout is how long the script can record 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, information similar to the following will be written in the specified log file:

[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(): It means that the execution time exceeds when executing this method.
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


Summary: The above is the entire content of this article, I hope it will be helpful to everyone's study.

Related recommendations:

PHP function curl request-fetch page/interface test

PHP function converts any number into the corresponding Chinese character numbers

Summary of PHP basic functions


The above is the detailed content of PHP performance analysis: usage of php-fpm slow execution log slow log. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template