0

面试官:磁盘 IO 变高,你怎么分析?

 2 years ago
source link: https://segmentfault.com/a/1190000041260535
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

面试官:磁盘 IO 变高,你怎么分析?

工具准备:

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

pt-ioprofile: http://www.percona.com/downlo...

IO高分析方法:

1、查看磁盘使用率 df -lh

2、安装iostat 安装命令: yum install sysstat

3、iostat -d -k 2 查看IO情况:

哪个磁盘的IO负载较高,接下来我们就来定位具体的负载来源

%util: 一秒中有百分之多少的时间用于 I/O 操作,或者说一秒中有多少时间 I/O 队列是非空的。即 delta(use)/s/1000 (因为use的单位为毫秒)

如果 %util 接近 100%,说明产生的I/O请求太多,I/O系统已经满负荷,该磁盘可能存在瓶颈。

4、安装iotop 命令:

安装命令:yum install iotop iotop 查看哪个线程耗IO比较高、按 o 只显示有磁盘 IO 活动的进程。

5、pt-ioprofile定位负载来源文件

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

pt-ioprofile的原理是对某个pid附加一个strace进程进行IO分析。
在这里插入图片描述

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

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

从上图可以看出IO负载的主要来源是jetty。

并且压力主要集中在读取上。

来源 | https://urlify.cn/JNRVJb


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK