penglongli / blog

18 stars 1 forks source link

Linux 下的 iostat 与 %iowait、%steal、IOPS #74

Open penglongli opened 6 years ago

penglongli commented 6 years ago

主要介绍下 iostat 的使用,以及其中一个参数 %steal。关于 %steal 的问题,与 top 的 id、wa 参数也有一定联系,下文会指出。

相关工具:sar、vmstat

iostat

iostat 我们通常用来看各物理设备的 I/O 情况,其实还可以查看 CPU、NFS 检查。其中 NFS 检查(-n 参数)不清楚是否已经被废弃,目前已经没有了 -n 参数

参考文档:https://linux.die.net/man/1/iostat

下文直接用具体的实例来演示:

示例 1

命令:iostat -k -x -N 1

参数:

图片

介绍下上图中一些参数的信息:

avg-cpu:

Device:

示例二

命令:iostat 1

root@host-1:~# iostat 1
Linux 4.4.0-91-generic (host-1)     01/24/2018  _x86_64_    (2 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.15    0.00    0.04    0.06    0.00   99.75

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
vda               0.26         0.98         3.80     537233    2090884
vdb               0.00         0.01         0.00       3152          0
vdc               0.00         0.00         0.00        340          0

参数:

%iowait

参考文章:

此项参数并不能作为衡量设备性能的指标

%steal

参考文章:

此项参数与虚拟机的性能息息相关,如果数值高则机器的状态非常糟糕

IOPS(IO Operations Per Second)

参考文章:

概念

过去 1s 时间的 I/O 操作的数量(读 + 写)

如何计算

https://unix.stackexchange.com/questions/225095/how-to-get-total-read-and-total-write-iops-in-linux