iostat is the Linux system is used to monitor I / O activity of the tool equipment, is input/output statistics
an abbreviation. It can generate three types of reports:
- CPU Utilization Report
- Equipment utilization reports
- Network File System Report
iostat to help administrators better adjust system settings through the reports generated to balance the I / O load across each physical disk.
Linux in iostat command is included in the package system sysstat
which, if not iostat
command you need to pre-installed sysstat
system package, available yum
commands to install:
# yum install sysstat -y
The main explanation
iostat [OPTION] [DEVICE] [INTERVAL [count]]
Parameters can be detailed with reference to: http://man7.org/linux/man-pages/man1/iostat.1.html
Report Description
Here frequently used mainly in CPU and disk I / O analysis report need to use the main.
CPU Utilization Report (CPU Utilization Report)
If the server is a multi-core CPU, the value of the average of all values of the core.
%user: CPU处在用户(应用)级别的利用率百分比。
%nice:CPU处在用户级别且有`NICE`值的利用率百分比。
%system:CPU处在系统(内核)级别的利用率百分比。
%iowait:CPU等待系统I/O请求的时间百分比。
%steal:虚拟CPU无意识等待系统程序处理另外的虚拟处理器所花费时间的百分比。
%idle:CPU空闲的时间百分比。
Capacity utilization report (Device Utilization Report)
Device:显示的是设备名或者是分区名。不同的内核版本有不同的显示方式。
tps:设备每秒的传输次数。一次传输就是对设备一次的`I/O`请求,多次的逻辑请求可以合并成单个`I/O`请求。
Blk_read/s:每秒从设备读取的数据量,以`BLOCK`方式计算,在内核`2.4`及之后版本中,每个`BLOCK`的大小为512字节。
Blk_wrtn/s:每秒写入设备的数据量。
Blk_read:总共读取的`BLOCK`数量。
Blk_wrtn:总共写入的`BLOCK`数量。
kB_read/s:每秒从设备读取的数据量,单位`KB`。
kB_wrtn/s:每秒写入设备的数据量,单位`KB`。
kB_read:总共从设备读取的数据量,单位`KB`。
kB_wrtn:总共写入设备的数据量,单位`KB`。
MB_read/s、MB_wrtn/s、MB_read、MB_wrtn:参考上述的信息描述,单位为`MB`。
rrqm/s:每秒合并的读请求数,当请求排队到设备时。
wrqm/s:每秒合并的写请求数,当请求排队到设备时。
r/s:每秒发送给设备的读请求数。
w/s:每秒发送给设备的写请求数。
rsec/s:每秒从设备读取的扇区数量。
wsec/s:每秒写入设备的扇区数量。
rkB/s:每秒从设备读取的`KB`数。
wkB/s:每秒写入设备的`KB`数。
rMB/s、wMB/s:参考上述的信息描述,单位为`MB`。
avgrq-sz:发送给设备请求的平均大小(以扇区为单位)。
avgqu-sz:发送给设备请求队列的平均长度。
await:发送给设备`I/O`请求的平均响应时间,单位是毫秒。包含请求于队列中的时间和服务于队列中的时间。
svctm:发送给设备`I/O`请求的平均服务时间。将在之后版本的`iostat`移除这个指标。
%util:发送给设备`I/O`请求消耗的时间的百分比。
Main options
-c:显示CPU利用率报告。
-d:显示设备利用率报告。
-k:输出统计信息以`KB/S`显示。
-m:输出统计信息以`MB/S`显示。
-N:显示逻辑卷(LVM)的信息。
-n:显示NFS的信息。
-p [ { device [,...] | ALL } ]:显示指定的磁盘设备或者分区信息。
-t:显示报告的时间。timestamp格式由环境变量`S_TIME_FORMAT`决定。
-x:显示扩展的统计信息。
-y:忽略从系统启动到当前时间第一份报告。
-z:忽略显示不活动设备的信息。
The main usage
1, the load of all devices
# iostat
Linux 2.6.32-358.el6.x86_64 (db) 10/25/2018 _x86_64_ (1 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
0.60 0.00 0.39 0.42 0.00 98.60
Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 1.83 0.84 26.61 1437902 45525316
OR
# iostat -x
Linux 2.6.32-358.el6.x86_64 (db) 10/25/2018 _x86_64_ (1 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
0.60 0.00 0.39 0.42 0.00 98.60
Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await r_await w_await svctm %util
sda 0.01 1.38 0.03 1.81 0.84 26.61 14.97 0.01 3.23 4.01 3.21 2.89 0.53
2, the display CPU information
# iostat -c 1 5
Linux 2.6.32-358.el6.x86_64 (db) 10/25/2018 _x86_64_ (1 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
0.60 0.00 0.39 0.42 0.00 98.60
avg-cpu: %user %nice %system %iowait %steal %idle
0.00 0.00 0.00 10.00 0.00 90.00
avg-cpu: %user %nice %system %iowait %steal %idle
0.00 0.00 0.00 0.00 0.00 100.00
avg-cpu: %user %nice %system %iowait %steal %idle
0.00 0.00 0.00 0.00 0.00 100.00
avg-cpu: %user %nice %system %iowait %steal %idle
0.00 0.00 0.00 0.00 0.00 100.00
3, display TPS
# iostat -d -k 1 3
Linux 2.6.32-358.el6.x86_64 (db) 10/25/2018 _x86_64_ (1 CPU)
Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn
sda 1.83 0.42 13.30 718951 22763214
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
4, the display device utilization (% util) and response time (the await)
# iostat -d -k -x 1 3
Linux 2.6.32-754.2.1.el6.x86_64 (db) 10/25/2018 _x86_64_ (24 CPU)
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm %util
sda 0.01 61.87 0.13 62.10 11.18 479.23 15.76 0.01 0.13 0.05 0.31
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm %util
sda 0.00 4.00 1.00 16.00 8.00 80.00 10.35 0.01 0.71 0.71 1.20
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm %util
sda 0.00 1.00 0.00 12.00 0.00 52.00 8.67 0.00 0.17 0.17 0.20
note:
The main usage is more information for all devices, if you need to specify a device, the device name can be added to a separate display;
if it does not boot server for the first time since statistics show information, you need to add the option-y
to remove.
to sum up
%util
If close to 100% , indicating that the disk has been processed the I / O request, the system I / O is the full load condition, there may be a disk I / O bottleneck, because if a plurality of disks concurrently, does not necessarily indicate that the disk bottleneck ;- Time response
await
time is typically lower than 5ms (<5ms), and if it exceeds 10ms (> 10ms) relatively big; %idle
If less than 30% , the I / O pressure is relatively large.
reference
- http://man7.org/linux/man-pages/man1/iostat.1.html
- https://linuxtools-rst.readthedocs.io/zh_CN/latest/tool/iostat.html
- http://www.ha97.com/4546.html
☆ 〖I is limited, the paper please leave a message if any errors also criticized the correction! ] ☆