linux iostat 命令
所属分类 linux
浏览量 969
iostat -d -k 2 6
-d 磁盘io
-k kilobytes
-m mbytes
每隔2秒刷新一次 刷新6次
-c cpu统计信息
-x io相关的扩展数据
关键指标说明
%iowait CPU等待输入输出完成时间的百分比
%iowait 过高,表示硬盘存在I/O瓶颈
%idle 高,表示CPU较空闲
如果%idle 高但系统响应慢,有可能是CPU等待分配内存,应加大内存
%idle 如果持续低于10,CPU资源是瓶颈
rrqm/s 每秒 merge 读操作数 rmerge/s
wrqm/s 每秒 merge 写操作数 wmerge/s
r/s 每秒完成的读 I/O 设备次数
w/s 每秒完成的写 I/O 设备次数
rsec/s 每秒读扇区数 rsect/s
wsec/s 每秒写扇区数 wsect/s
rkB/s 每秒读 K 字节数 ,扇区大小为 512 字节
wkB/s 每秒写 K 字节数
avgrq-sz 平均每次设备 I/O 操作的数据大小(扇区)
avgqu-sz 平均 I/O 队列长度
await 平均每次设备 I/O 操作的等待时间(毫秒)
svctm 平均每次设备 I/O 操作的服务时间(毫秒)
%util 一秒中有百分之多少的时间用于 I/O 操作,或者说一秒中有多少时间 I/O 队列是非空的
%util 接近 100%,说明I/O请求太多, 磁盘可能存在瓶颈
svctm 比较接近 await,说明 I/O 几乎没有等待时间
await 远大于 svctm,说明I/O 队列太长,io响应太慢,需要进行优化
avgqu-sz 比较大,也表示有io等待
svctm 的大小一般和磁盘性能有关,CPU/内存的负荷也会对其有影响,请求过多也会间接导致 svctm的增加
await 的大小一般取决于服务时间(svctm) 以及 I/O 队列的长度和 I/O 请求模式
如果响应时间过大,可以考虑更换更快的磁盘,调整内核 elevator 算法,优化应用,或者升级 CPU
如果%util 很大,而 rkB/s 和 wkB/s 很小,可能存在较多的随机读写,可优化成顺序读写
iostat 2
Linux 3.10.0-693.el7.x86_64 (dyyx) 2020年11月17日 _x86_64_ (32 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
0.61 0.00 0.26 0.02 0.00 99.11
Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn
sda 11.78 33.14 458.04 1179469967 16303912479
avg-cpu: %user %nice %system %iowait %steal %idle
0.50 0.00 0.30 0.00 0.00 99.20
Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn
sda 0.00 0.00 0.00 0 0
avg-cpu: %user %nice %system %iowait %steal %idle
0.53 0.00 0.28 0.00 0.00 99.19
iostat -d
Linux 3.10.0-693.el7.x86_64 (dyyx) 2020年11月17日 _x86_64_ (32 CPU)
Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn
sda 11.78 33.14 458.05 1179469967 16303899228
iostat -d 2 3
Linux 3.10.0-693.el7.x86_64 (dyyx) 2020年11月17日 _x86_64_ (32 CPU)
Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn
sda 11.78 33.14 458.05 1179469967 16303905954
Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn
sda 0.00 0.00 0.00 0 0
Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn
sda 0.00 0.00 0.00 0 0
iostat -d -x 2
Linux 3.10.0-693.el7.x86_64 (k8s-master) 2020年11月17日 _x86_64_ (32 CPU)
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
sda 0.00 0.39 1.20 10.58 33.14 458.04 83.39 0.05 4.38 51.68 10.42 0.13 0.15
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
sda 0.00 0.00 0.00 12.00 0.00 85.00 14.17 0.00 0.04 0.00 0.04 0.04 0.05
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
tps
Indicate the number of transfers per second that were issued to the device.
A transfer is an I/O request to the device. Multiple logical requests can be combined into a single I/O request to the device. A transfer is of indeterminate size.
Blk_read/s (kB_read/s, MB_read/s)
Indicate the amount of data read from the device expressed in a number of blocks (kilobytes, megabytes) per second.
Blocks are equivalent to sectors and therefore have a size of 512 bytes.
Blk_wrtn/s (kB_wrtn/s, MB_wrtn/s)
Indicate the amount of data written to the device expressed in a number of blocks (kilobytes, megabytes) per second.
Blk_read (kB_read, MB_read)
The total number of blocks (kilobytes, megabytes) read.
Blk_wrtn (kB_wrtn, MB_wrtn)
The total number of blocks (kilobytes, megabytes) written.
rrqm/s
The number of read requests merged per second that were queued to the device.
wrqm/s
The number of write requests merged per second that were queued to the device.
r/s
The number (after merges) of read requests completed per second for the device.
w/s
The number (after merges) of write requests completed per second for the device.
rsec/s (rkB/s, rMB/s)
The number of sectors (kilobytes, megabytes) read from the device per second.
wsec/s (wkB/s, wMB/s)
The number of sectors (kilobytes, megabytes) written to the device per second.
avgrq-sz
The average size (in sectors) of the requests that were issued to the device.
avgqu-sz
The average queue length of the requests that were issued to the device.
await
The average time (in milliseconds) for I/O requests issued to the device to be served.
This includes the time spent by the requests in queue and the time spent servicing them.
r_await
The average time (in milliseconds) for read requests issued to the device to be served.
This includes the time spent by the requests in queue and the time spent servicing them.
w_await
The average time (in milliseconds) for write requests issued to the device to be served.
This includes the time spent by the requests in queue and the time spent servicing them.
svctm
The average service time (in milliseconds) for I/O requests that were issued to the device.
Warning! Do not trust this field any more.
This field will be removed in a future sysstat version.
%util
Percentage of elapsed time during which I/O requests were issued to the device (bandwidth utilization for the device).
Device saturation occurs when this value is close to 100%.
上一篇
下一篇
k8s面试题
top命令输出说明
linux mpstat 命令
linux sysstat
jvm到底能运行多少个线程
aerospike数据删除机制