MySQL database CPU soaring Emergency Handling Method

Source: Internet
Author: User
Note: Thereisafileembeddedwithinthispost, pleasevisitthisposttodownloadthefile. mySQL database CPU soar Emergency Handling Method for a database that runs smoothly. If the CPU usage rate reaches about 80%, it must be caused by bad SQL statements written by developers. What DBAs must ensure first is, do not run the database, so

Note: There is a file embedded within this post, please visit this post to download the file. mySQL database CPU soar Emergency Handling Method for a database that runs smoothly. If the CPU usage rate reaches about 80%, it must be caused by bad SQL statements written by developers. What DBAs must ensure first is, do not run the database, so

Note: There is a file embedded within this post, please visit this post to download the file.

MySQL database CPU soaring Emergency Handling Method

If the CPU usage of a stable database is so high as 80%, it must be caused by bad SQL statements developed and written. The DBA must first ensure that the database should not run down, therefore, we need to kill slow SQL statements and record them in the file for subsequent troubleshooting. Here we use a tool pt-kill to help you.

1

pt-kill? --match-info "^(select|SELECT)" --busy-time 3 --victim all --interval 1 --kill --print --daemonize > /root/kill.txt

Explanation: only the SQL statements that take more than three seconds for the select statement are killed and printed out.

Simulated Test

In this way, the server is killed and then the LOG is viewed.

The SQL statements that will be killed will be recorded, and further troubleshooting will be conducted with the development team. The problematic SQL statements cannot be released at will!

Original article address: MySQL database CPU soaring emergency handling method, thanks to the original author for sharing.

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.