温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

pt-ioprofile

发布时间:2020-08-03 18:20:03 来源:网络 阅读:710 作者:Darren_Chen 栏目:MySQL数据库

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


警告和风险:

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

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


格式:

pt-ioprofile [OPTIONS] [FILE]


默认参数:

--aggregate       The aggregate function, either C<sum> or C<avg>.


--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


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI