Preface
As a matter of fact,disk IO is the most important factor which tremendously influence performance of database especially in OLTP which is usually called IO-intensive system.The high concurrency is always in company with high IOPS as well.Furthermore,it`s also a bottleneck in many scenarios.Thus,we have to monitor the IO cost of MySQL db by different tools such as zabbix,lepus.They usually provide a entire db performance monitoring not merely IO status.
Introduce
pt-ioprofile is a tool of Percona-Toolkit which can be used to monitor the IO activities by MySQL itself.It provide direct and quantitive informations and indicate the real IO costs by different processes or relevent files.pt-ioprofile is the tool which combines lsof and strace to analyze informations.
Procedure
Usage
1 pt-ioprofile [OPTIONS] [FILE]
Main parameter(they`re almost entire)
1 --aggregate -- Whether use aggregate function or not(default "sum",others "avg"). 2 --cell -- Specify the type of cell contents(default "times",others "size","count"). 3 --group-by -- Specify the type of group by contents(default "filename",others "all","pid"). 4 --profile-process -- Specify the process which is to be profiled(default muysqld). 5 --profile-pid -- Specify the pid instead of prcocess name. 6 --run-time -- Specify how long time it will take(default 30s). 7 --save-samples -- Specify a file which sample data can be put in.
Examples
Execute pt-ioprofile to have a test.
1 [root@zlm2 08:47:12 ~] 2 #ps aux|grep mysqld 3 mysql 8971 0.0 19.0 1108096 193900 pts/1 Sl 08:29 0:00 mysqld --defaults-file=/data/mysql/mysql3306/my.cnf 4 root 9319 0.0 0.0 112640 960 pts/2 R+ 08:47 0:00 grep --color=auto mysqld 5 6 [root@zlm2 08:47:14 ~] 7 #pt-ioprofile --cell size --run-time 10 8 Tue Jun 26 08:47:29 CEST 2018 9 Tracing process ID 8971 10 total filename -- There`s nothing output here,I`m afraid I`ve encountered a bug. 11 12 ###Here`s a website about the bug.### 13 https://bugs.launchpad.net/percona-toolkit/+bug/925778 14 15 [root@zlm2 08:47:40 ~] 16 #pt-ioprofile --version 17 pt-ioprofile 3.0.10 -- My version of Percorna-Toolkit is 3.0.10. 18 19 [root@zlm2 08:47:46 ~] 20 #yum list|grep percona-toolkit 21 percona-toolkit.x86_64 3.0.10-1.el7 installed
Erase the latest Porcona-Toolkit 3.10.0 and change the old version 2.2.20.
1 root@zlm2 08:49:16 ~] 2 #yum erase percona-toolkit 3 4 [root@zlm2 09:02:55 ~] 5 #wget https://www.percona.com/downloads/percona-toolkit/2.2.20/RPM/percona-toolkit-2.2.20-1.noarch.rpm 6 7 [root@zlm2 09:04:47 ~] 8 #yum localinstall percona-toolkit-2.2.20-1.noarch.rpm 9 10 [root@zlm2 09:05:05 ~] 11 #pt-ioprofile --version 12 pt-ioprofile 2.2.20 13 14 [root@zlm2 09:06:46 ~] 15 #time pt-ioprofile --cell size --run-time 10 16 Tue Jun 26 09:07:36 CEST 2018 17 Tracing process ID 8971 18 total filename -- It still doesn`t work properly without a file specified. 19 20 real 0m11.127s 21 user 0m0.048s 22 sys 0m0.081s
There`re percona release notes below which describes the bug is fixed in v2.0.3.
1 https://www.percona.com/doc/percona-toolkit/3.0/release_notes.html 2 ... 3 Fixed bug 925778: pt-ioprofile doesn’t run without a file 4 ...
I`m really confused with why it cannot be executed properly even though in the newest version.No more stuff I can find to solve the problem now.Maybe I`ll test it another day.