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.
Source location with high IO load