Iotop,pt-ioprofile:mysql IO High-load source location

Source: Internet
Author: User
Tags percona python script

Objective:

In general operations work often encounter such a scenario, the server's IO load is very high (util in iostat), but unable to quickly locate the IO load source process and source files resulting in the inability to make the appropriate policy to solve the problem.

This phenomenon is more common on MySQL, and before 5.6 (Performance_schema provides IO instrument), we can usually only guess the high IO caused by MySQL, but we can't pinpoint which file is the load.

For example, is Ibdata's brush-writing? or random reading of an unpopular IBD?

This article will introduce a relatively simple process of positioning IO high load.

Tool Preparation:

iotop:http://guichaz.free.fr/iotop/

Pt-ioprofile:http://www.percona.com/downloads/percona-toolkit/2.2.1/

Step1:iostat Viewing IO conditions

Iostat-x 1 Look at the IO situation, you can see that the DFA disk has a higher IO load, and then we'll locate the specific load source.

Step2:iotop locating the load source process

The essence of Iotop is a Python script that gets the IO information of thread from the proc and summarizes it.

It can be seen that most of the IO sources come from the mysqld process. It is therefore possible to determine the load source of the DFA as a database

STEP3 pt-ioprofile Locating the load source file

The principle of pt-ioprofile is to attach an strace process to a certain PID for IO analysis.

Here is an excerpt from the official website:

However, it works by attaching Strace to the process using ptrace (), which would make it run very slowly Until strace detaches. In addition to freezing the server, there was also some risk of the process crashing or performing badly after strace detaches from it, or indeed of strace not detaching cleanly and leaving the process in a sleeping state. As a result, this should is considered an intrusive tool, and should not being used on production servers unless is COMF Ortable with that.

The process number of the MYSQLD process is found through the PS Aux|grep mysqld, which is viewed by pt-ioprofile to see which file has the most IO time.

The tool shows the time that the IO occupies by default parameters.

More useful for locating problems is locating through IO throughput. Using the parameter--cell=sizes, this parameter shows the result in B/s way

The main source of Io load can be seen as sbtest (Sysbench io bound OLTP test).

And the pressure is mainly concentrated on the reading.

Iotop,pt-ioprofile:mysql IO High-load source location

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.