MySQL database CPU Spike emergency handling method

Source: Internet
Author: User

MySQL database CPU Spike emergency handling method

Run a smooth database, if you encounter CPU hurricane, to 80% or so, it must be developed to write bad SQL caused, the DBA first to ensure that the database does not run off, so we have to put those running slow SQL killed and recorded in the file, so that the subsequent troubleshooting.

Here is a tool pt-kill that can help you.

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

 

explanation: Only SQL that takes more than 3 seconds to select is killed and printed out.

simulation test

This will kill, and then look at log.

Will kill the SQL recorded, and then with the development of slowly troubleshooting, the problem of SQL must not let the development of random on-line!

This article is from the "Spring Yang Technical column" blog, please be sure to keep this source http://hcymysql.blog.51cto.com/5223301/1353820

MySQL database CPU Spike emergency handling method

Related Article

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.