IO负载高来源定位pt-ioprofile

 

1.使用top -d 1 查看%wa是否有等待IO完成的cpu时间,简单理解就是指cpu等待磁盘写入完成的时间;IO等待所占用的cpu时间的百分比,高过30%时IO压力高;

2.使用iostat -d -x 1 输出(-x表示显示和io相关的扩展数据);

3.使用iotop定位负载来源工具具体查看IO负载主要是落在哪个进程上了;如何规避IO负载过高的问题呢?具体问题具体分析:
 1)如果你的服务器用来做日志分析,要避免多个crontab交叠执行导致多进程随机IO(参考:随机IO vs 顺序IO),避免定期的压缩、解压大日志(这种任务会造成某段时间的IO抖动)。
 2)如果是前端应用服务器,要避免程序频繁打本地日志、或者异常日志等。
 3)如果是存储服务(mysql、nosql),尽量将服务部署在单独的节点上,不要和其它服务共用,甚至服务本身做读写分离以降低读写压力;调优一些buffer参数以降低IO写的频率等等。另外还可以参考LevelDB这种将随机IO变顺序IO的经典方式。

附IO参考资料:
http://oplinux.com/order/iostat.html
http://bencane.com/2012/08/06/troubleshooting-high-io-wait-in-linux/

 

IO负载高来源定位

准备工具:

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

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

4.pt-ioprofile定位负载来源文件,通过ps找出负载较高的进程

   pt-ioprofile的原理是对某个pid附加一个strace进程进行IO分析。以下是摘自官网的一段警示:

   However, it works by attaching strace to the process using ptrace(), which will make it run very slowly until strace detaches. In addition to freezing the server, there is 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 be considered an intrusive tool, and should not be used on production servers unless you are comfortable with that.

命令格式:pt-ioprofile  --profile -pid=xxx 

                  pt-ioprofile  --profile -pid=xxx  --cell=sizes   

注:对于定位问题更有用的是通过IO的吞吐量来进行定位。使用参数 --cell=sizes,该参数将结果已 B/s 的方式展示出来

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值