iostat

Monitor system input and output device and CPU usage

Supplementary instructions

iostat command is used to monitor system input and output device and CPU usage. Its feature is to report disk activity statistics and CPU usage. Like vmstat, iostat also has a weakness, that is, it cannot conduct in-depth analysis of a certain process, but only analyzes the overall situation of the system.

grammar

iostat(options)(parameters)

Options

-c: only displays CPU usage;
-d: Only display device utilization;
-k: Display status in kilobytes per second instead of blocks per second;
-m: Display status in megabytes per second;
-p: Only display the status of block devices and all other partitions being used;
-t: Displays the time when each report is generated;
-V: Display the version number and exit;
-x: Display extension status.

Parameters

Example

Use iostat -x /dev/sda1 to view disk I/O details:

iostat -x /dev/sda1
Linux 2.6.18-164.el5xen (localhost.localdomain)
March 26, 2010

avg-cpu: %user %nice %system %iowait
%steal %idle
             0.11 0.02 0.18 0.35
0.03 99.31

Device: tps Blk_read/s Blk_wrtn/s
Blk_read Blk_wrtn
sda1 0.02 0.08
0.00 2014 4

Detailed description: The second line is the system information and monitoring time, the third and fourth lines show the CPU usage (the specific content is the same as the mpstat command). Here we mainly focus on the information output by the subsequent I/O, as shown below:

LabelDescription
DeviceMonitoring device name
rrqm/sNumber of read requests per second
wrqm/sNumber of write requests per second
r/sNumber of actual read requests per second
w/sNumber of actual write requests per second
rsec/sNumber of segments read per second
wsec/sNumber of segments written per second
rkB/sActual read size per second, in KB
wkB/sActual write size per second, in KB
avgrq-szaverage size segment required
avgqu-szaverage queue length of demand
awaitAverage time to wait for I/O (milliseconds)
svctmAverage time to complete I/O requirements
%utilDevice bandwidth usage, reaching 100% means saturation and reaching a performance bottleneck. If it is a device that supports processing concurrent requests, it does not mean a performance bottleneck.