PHP performance analysis php-fpm slow execution log slow logs usage _php skills

Source: Internet
Author: User
Tags exception handling fpm php error

This article describes the PHP performance analysis of php-fpm slow execution log slow logs usage. Share to everyone for your reference, specific as follows:

As we all know, MySQL has slow query log, and we can tell that those SQL statements have performance problems based on the slow search logs. As a good partner for MySQL, PHP has the same functionality. If you use PHP-FPM to manage PHP, you can open it with the following options.

The PHP 5.3.3 was previously set as follows:

<value name= "Request_slowlog_timeout" >5s</value>
<value name= "Slowlog" >logs/ Php-fpm-slowlog.log</value>

The following PHP 5.3.3 are set:

Request_slowlog_timeout = 5s
Slowlog =/usr/local/php/log/php-fpm-slowlog.log

Description

Request_slowlog_timeout is how long a script can be logged to a log file
Slowlog is the path to the log file

Once turned on, if a script executes for more than a specified time, a message similar to the following is written to 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 (): Indicates that the execution time is exceeded when the method is executed.
Exfilter_curl_get (): Describes the method for calling Curl_exec () is Exfilter_curl_get ().

The number following the colon of each line is the line number.

When turned on, there are also 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

More interested in PHP related content readers can view the site topics: "PHP error and Exception handling method summary", "PHP string (String) Usage summary", "PHP Array" Operation Techniques Encyclopedia, "PHP operation and operator Usage Summary", " PHP Network Programming Skills Summary, "Introduction to PHP Basic Grammar", "PHP object-oriented Programming Introductory Course", "Php+mysql Database Operation Introduction" and "PHP common database Operation Skills Summary"

I hope this article will help you with the PHP program design.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.