Analysis of Mysql errors caused by slow php logs _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
Analysis of Mysql errors caused by slow php logs. In our project, enabling PHP slow logs (request_slowlog_timeout10s) is a required option, and it also makes us find many pitfalls and solves many performance problems. Yesterday, in our project, enabling PHP slow logs (request_slowlog_timeout = 10 s) was a required option, and it also made us discover many pitfalls and solved many performance problems.

Yesterday, due to a very strange problem, we had to disable the PHP slow log. what is the problem?

Problem: When the program is executed, 2013 (Lost connection to MySQL server during query) is reported)

Analysis:

1) in our background program, a loop (> 300 times) will be executed, and an SQL statement will be executed repeatedly in the loop;
2) Nginx access logs. each execution time of the program is about 12 seconds;
3) modify the mysql connection class. before querying, executing mysql_ping is also invalid, and the problem persists;

Just as I couldn't explain it, I thought, shut down the php slow log and try again. as you can imagine, the problem is quite good ....

As for the reason, I really don't know!

Commit (request_slowlog_timeout = 10 s) is a required option, and it also allows us to discover many pitfalls and solve many performance problems. Yesterday...

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.