pt-ioprofile-创新互联

pt-ioprofile是属于percona-toolkit中的一个工具,用strace和lsof来查监视进程的IO情况并打印表文件和活动IO,默认监视mysqld进程30秒

成都地区优秀IDC服务器托管提供商(成都创新互联).为客户提供专业的绵阳电信机房,四川各地服务器托管,绵阳电信机房、多线服务器托管.托管咨询专线:18980820575

警告和风险:

pt-ioprofile可能会冻结服务,crash进程,是进程变得更糟糕,或者使进程休眠。

pt-ioprofile是一个有干扰的工具,一般不用在生产环境中,除非你能理解和接受风险。

格式:

pt-ioprofile [OPTIONS] [FILE]

默认参数:

--aggregate    The aggregate function, either C or C.

--cell      The cell contents.

有三个值:

count Count of I/O operations

sizes Sizes of I/O operations

times I/O operation timing(默认)

--group-by    The group-by item.

有三个值:

all    Summarize into a single line of output

filename One line of output per filename (默认)

pid    One line of output per process ID

 --profile-pid   The PID to profile, overrides L<"--profile-process">.

#指定监控的进程号

 --profile-process The process name to profile.

指定监控的进程名

 --run-time    How long to profile.

#监控时长,默认30S

 --save-samples  Filename to save samples in; these can be used for later  analysis.

例:

#用sysbench插入测试数据

[root@Darren1 lua]# sysbench --time=20 --threads=4 --mysql-host=localhost --mysql-user=root --mysql-password='147258' --mysql-db=sbtest --tables=10 --table_size=100000 /home/mysql/sysbench-1.0.3/src/lua/oltp_insert.lua prepare

#监控mysqld进程相关的IO:

[root@Darren1 sysbench-1.0.3]# pt-ioprofile --run-time=5

Thu Jun 1 22:46:29 CST 2017

Tracing process ID 5875

   total   pread    read   pwrite   write   fsync    open   close   lseek ftruncate filename

 4.774836  2.253120  0.000000  1.855958  0.000000  0.665758  0.000000  0.000000  0.000000  0.000000 /data/mysql/mysql3306/data/ibdata1

 0.873437  0.000000  0.000000  0.000000  0.293659  0.000000  0.000000  0.000000  0.000045  0.579733 /data/mysql/mysql3306/data/innodb_status.5875

 0.615918  0.000000  0.000000  0.000000  0.000000  0.615918  0.000000  0.000000  0.000000  0.000000 /data/mysql/mysql3306/data/undo001

 0.420569  0.420518  0.000000  0.000000  0.000000  0.000051  0.000000  0.000000  0.000000  0.000000 /data/mysql/mysql3306/data/undo002

 0.224583  0.000000  0.000000  0.000000  0.000000  0.224583  0.000000  0.000000  0.000000  0.000000 /data/mysql/mysql3306/data/sbtest/sbtest4.ibd

 0.033272  0.000000  0.033259  0.000000  0.000000  0.000000  0.000000  0.000000  0.000013  0.000000 /data/mysql/mysql3306/logs/mysql-bin.000035

 0.028929  0.000000  0.000000  0.000000  0.000000  0.028929  0.000000  0.000000  0.000000  0.000000 /data/mysql/mysql3306/data/mysql/innodb_index_stats.ibd

 0.025752  0.000000  0.000000  0.000000  0.000000  0.025752  0.000000  0.000000  0.000000  0.000000 /data/mysql/mysql3306/data/sbtest/sbtest1.ibd

 0.007142  0.000000  0.000000  0.000000  0.000000  0.007142  0.000000  0.000000  0.000000  0.000000 /data/mysql/mysql3306/data/undo003

 0.006129  0.000000  0.000000  0.000318  0.000000  0.005811  0.000000  0.000000  0.000000  0.000000 /data/mysql/mysql3306/data/ib_logfile0

 0.004302  0.000000  0.000000  0.000000  0.000000  0.004302  0.000000  0.000000  0.000000  0.000000 /data/mysql/mysql3306/data/sbtest/sbtest2.ibd

 0.000350  0.000000  0.000152  0.000000  0.000000  0.000000  0.000119  0.000079  0.000000  0.000000 /dev/urandom

 0.000180  0.000000  0.000000  0.000000  0.000180  0.000000  0.000000  0.000000  0.000000  0.000000 /data/mysql/mysql3306/data/general.log

 0.000135  0.000000  0.000000  0.000000  0.000000  0.000135  0.000000  0.000000  0.000000  0.000000 /data/mysql/mysql3306/data/sbtest/sbtest3.ibd

 0.000053  0.000000  0.000000  0.000000  0.000000  0.000053  0.000000  0.000000  0.000000  0.000000 /data/mysql/mysql3306/data/mysql/innodb_table_stats.ibd

 0.000030  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000030  0.000000 /data/mysql/mysql3306/tmp/ib49MzXQ

 0.000024  0.000000  0.000000  0.000000  0.000024  0.000000  0.000000  0.000000  0.000000  0.000000 /data/mysql/mysql3306/data/error.log

另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


分享题目:pt-ioprofile-创新互联
当前链接:http://ybzwz.com/article/dpigdh.html