Iostat command
Syntax: iostat [-c] [-d] [-h] [-n] [-K |-m] [-t] [-v] [-X] [-z] [device [...] | ALL] [-p [device [,...] | all] [interval [count]]
-C can be used to get CPU partial state values
-D indicates that the device (disk) usage status is displayed;
-K Some columns using block are forced to use the kilobytes unit;
-X This option will be used to display and IO-related extended data
Common usage
Iostat-d-K 1 #查看TPS和吞吐量信息 (disk read and write speed in KB) iostat-d-M 2 #查看TPS和吞吐量信息 (disk read and write speed in MB) iostat-d-x-k 1 #查看设备使 Use Rate (%util), Response time (await) Iostat-c 1 #查看cpu状态
Iostat Result Analysis
[Email protected] ~]# iostat-x
Linux 2.6.9-78.ELSMP (20081006-1724) 11/20/2009
AVG-CPU:%user%nice%sys%iowait%idle
0.19 0.00 0.04) 0.03 99.73
device:rrqm/s wrqm/s r/s w/s rsec/s wsec/s rkb/s wkb/s avgrq-sz avgqu-sz await SVCTM%util
SDA 0.05 17.60 1.46 7.72 80.69 202.57 40.34 101.29 30.87 0.01 1.06 0.37 0.34
SDA1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 29.90 0.00 3.14 3.14 0.00
Sda2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 16.25 0.00 1.51 1.30 0.00
Sda3 0.05 17.60 1.46 7.72 80.69 202.57 40.34 101.29 30.87 0.01 1.06 0.37 0.34
dm-0 0.00 0.00 1.46 25.28 80.32 202.26 40.16 101.13 10.57 0.36 13.56 0.13 0.34
Dm-1 0.00 0.00 0.05 0.04 0.37 0.32 0.18 0.16 8.00 0.00 6.84 1.30 0.01
RRQM/S: The number of read operations per second for the merge. Delta (rmerge)/s
WRQM/S: The number of write operations per second for the merge. Delta (wmerge)/s
R/S: Number of Read I/O devices completed per second. Delta (RIO)/s
W/S: Number of write I/O devices completed per second. Delta (WIO)/s
RSEC/S: Number of Read sectors per second. Delta (rsect)/s
WSEC/S: Number of Write sectors per second. Delta (wsect)/s
rkb/s: Reads K bytes per second. is half the rsect/s because the size of each sector is 512 bytes.
wkb/s: Writes K bytes per second. is half the wsect/s.
Avgrq-sz: The average data size (sector) per device I/O operation. Delta (rsect+wsect)/delta (Rio+wio)
Avgqu-sz: Average I/O queue length. That is Delta (AVEQ)/s/1000 (because the Aveq is in milliseconds).
Await: The average wait time (in milliseconds) for each device I/O operation. Delta (ruse+wuse)/delta (Rio+wio)
SVCTM: The average service time (in milliseconds) per device I/O operation. Delta (use)/delta (RIO+WIO)
%util: How much time in a second is spent on I/O operations, or how many times in a second I/O queues are non-empty.
That is, the delta (use)/s/1000 (because the unit of use is milliseconds)
If%util is close to 100%, it indicates that there are too many I/O requests and that the I/O system is fully loaded, the disk
There may be bottlenecks.
More important parameters
%util: How much time is spent in a second for I/O operations, or how many times in a second I/O queues are non-empty
svctm: Average service time Per device I/O operation
await: average wait time per device I/O operation
Avgqu-sz: Average I/O Queue Length
If%util is close to 100%, indicating too many I/O requests, the I/O system is full load, the disk may have a bottleneck, the general%util is larger than 70%,i/o pressure, the reading speed has more wait. You can also combine vmstat to view the B parameter ( The number of processes waiting on the resource) and the WA parameter (the percentage of CPU time that IO waits is higher than 30% when the IO pressure is high). The size of the
await typically depends on the service time (SVCTM) and the length of the I/O queue and the emit mode of the I/O request. If SVCTM is closer to await, it indicates that I/O has almost no wait time, and if the await is much larger than SVCTM, the I/O queue is too long and the application gets slower response times.
image metaphor
r/s+w/s similar to total number of contributions
Average queue Length (AVGQU-SZ) is similar to the number of average queued people per time
Avg. Service Time (SVCTM) Similar to the cashier's payment speed
Average wait time (await) is similar to average per person wait time
Average I/O data (AVGRQ-SZ) is similar to what the average person buys. The
I/O operation rate (%util) is similar to the time scale at which someone is queuing at the cashier
Device IO operation: Total io (IO)/s = r/s (read) +w/s (write) =1.46 + 25.28=26.74
The average Per device I/O operation only takes 0.36 milliseconds to complete and now takes 10.57 milliseconds because too many requests are made ( 26.74 per second), if the request is issued at the same time, you can calculate the average wait time:
Average Wait time = single I/O server time * (total number of 1+2+...+ requests-1)/Total requests
A lot of i/0 requests per second, but the average queue is 4, Indicates that these requests are fairly uniform, and most of the processing is relatively timely
SVCTM is generally smaller than await (because the waiting time for waiting requests is repeated),
The size of the SVCTM is generally related to disk performance, and the load on cpu/memory can have an impact on it, too many requests
will also indirectly lead to an increase in SVCTM. The size of the await is generally dependent on the service time (SVCTM) and
The length of the I/O queue and the emit mode of the I/O request. If SVCTM is closer to await, explain
I/O has almost no wait time; If the await is much larger than SVCTM, the I/O queue is too long to apply
The resulting response time is slow, if the response time is more than the user can tolerate, then you can consider
Replace faster disks, adjust kernel elevator algorithms, optimize applications, or upgrade CPUs.
The queue Length (AVGQU-SZ) can also be used as an indicator for measuring the system I/O load, but since Avgqu-sz is
It does not reflect instantaneous I/O flooding by average per unit of time.
Iostat command Explanation