Introduction
Iostat is mainly used to monitor the IO load of system devices. iostat displays the statistics from the start of the system when it is run for the first time. After iostat is run, statistics from the last run of the command are displayed. You can specify the number and time of statistics to obtain the required statistics.
Syntax
Iostat [-C] [-D] [-H] [-N] [-k |-M] [-T] [-V] [-x] [-Z] [device [...] | all] [-P [device [,...] | all] [interval [count]
Getting started
Iostat-D-K 2
The-D parameter indicates that the Usage Status of the device (Disk) is displayed. The-k parameter indicates that kilobytes is used as the unit of block usage, and 2 indicates that the data is refreshed every 2 seconds.
Output:
Iostat-D-K 1 10 Device: TPS kb_read /S kb_wrtn/ S kb_read kb_wrtnsda 39.29 21.14 1.44 441339807 29990031 Sda1 0.00 0.00 0.00 1623 523 Sda2 1.32 1.43 4.54 29834273 94827104 Sda3 6.30 0.85 24.95 17816289 520725244 Sda5 0.85 0.46 3.40 9543503 70970116 Sda6 0.00 0.00 0.00 550 236 Sda7 0.00 0.00 0.00 406 0 Sda8 0.00 0.00 0.00 406 0 Sda9 0.00 0.00 0.00 406 0 Sda10 60.68 18.35 71.43 383002263 1490928140 Device: TPS kb_read /S kb_wrtn/ S kb_read kb_wrtnsda 327.55 5159.18 102.04 5056 100 Sda1 0.00 0.00 0.00 0 0
Significance of output information
TPS: the number of transmissions per second (indicate the number of transfers per second that were issued to the device .)."One Transmission"It means"One I/O Request". Multiple logical requests may be merged"One I/O Request"."One Transmission"The request size is unknown. Kb_read/S: the amount of data read from the drive expressed per second;
Kb_wrtn/S: The amount of data written to the drive expressed per second;
Kb_read: the total data size to be read; kb_wrtn: the total data size to be written; these units are kilobytes.
In the above example, we can see the statistics of the disk SDA and its various partitions. At that time, the total TPS of the disk is 39.29. below is the TPs of each partition. (Because it is an instantaneous value, the total TPS is not exactly equal to the total TPS of each partition)
Specify the monitored device name as SDA. The output result of this command is identical to that of the preceding command.
Iostat-D SDA2
By default, all hard disk devices are monitored. Currently, only SDA is monitored.
-X Parameters
Iostat also has a common option-XThis option is used to display io-related extended data.
Iostat-D-X-K 1 10 Device: rrqm /S wrqm/s r/S W /S rsec/s wsec/s RKb/s WKB/s avgrq-SZ avgqu-SZ await svctm % Utilsda 1.56 28.31 7.80 31.49 42.51 2.92 21.26 1.46 1.16 0.03 0.79 2.62 10.28 Device: rrqm /S wrqm/s r/S W /S rsec/s wsec/s RKb/s WKB/s avgrq-SZ avgqu-SZ await svctm % Utilsda 2.00 20.00 381.00 7.00 12320.00 216.00 6160.00 108.00 32.31 1.75 4.50 2.17 84.20
Meaning of output information
Rrqm/s: the number of read requests related to this device per second is merge (when the system calls a request to read data, VFS sends the request to each FS, if FS finds that different read requests read data of the same block, FS will merge the request with merge); wrqm/ S: The number of write requests related to this device per second is merge. Rsec / S: number of sectors read per second; wsec /: Number of sectors written per second. RKb / S: The number of read requests that were issued to the device per second; WKB /S: the number Write Requests that were issued to the device per second; avgrq - SZ average request sector size avgqu - SZ is the length of the average request queue. Undoubtedly, the shorter the queue length, the better. Await: Average time (in milliseconds) for processing each Io request ). It can be understood as the IO response time. Generally, the system Io response time should be less than 5 ms. If it is greater than 10 ms, it will be relatively large. This time includes the queue time and service time. That is to say, in general, await is larger than svctm, and the smaller the difference, the shorter the queue time, and the larger the difference, the longer the queue time, it indicates a problem with the system.Svctm indicates the average service time (in milliseconds) for each device I/O operation ).If the svctm value is very close to await, it indicates that there is almost no I/O wait, and the disk performance is good. If the await value is much higher than the svctm value, it indicates that the I/O queue waits too long for applications running on the systemProgramIt slows down.
% Util: All Io processing time within the statistical time, divided by the total statistical time. For example, if the statistical interval is 1 second, the device processes Io for 0.8 seconds, and the device is idle for 0.2 seconds, then % util = 0.8 / 1 = 80 %, So this parameter implies the degree of Device Busy
. Generally, if this parameter is set to 100%, it indicates that the device is nearly running at full capacity (of course, if it is a multi-disk, even if % util is 100%, because of the concurrency of the disk, so the disk usage may not be a bottleneck ).
-C Parameters
Iostat can also be used to obtain the status values of some CPUs:
Iostat-C1 10AVG-CPU: % USER %Nice% Sys % iowait %Idle1.98 0.00 0.35 11.45 86.22AVG-CPU: % USER %Nice% Sys % iowait %Idle1.62 0.00 0.25 34.46 63.67
Common usage
Iostat-D-K1 10# View TPS and throughput information (disk read/write speed in KB) iostat-D-m2# View TPS and throughput information (disk read/write speed in MB) iostat-D-X-K1 10# View the device usage (% util) and response time (await) iostat-C1 10# View CPU status
Instance analysis
Ostat-D-K 1 | Grep Sda10device: TPS kb_read /S kb_wrtn/S kb_read kb_wrtnsda10 60.72 18.95 71.53 395637647 1493241908 Sda10 299.02 4266.67 129.41 4352 132 Sda10 483.84 4589.90 4117.17 4544 4076 Sda10 218.00 3360.00 100.00 3360 100 Sda10 546.00 8784.00 124.00 8784 124 Sda10 827.00 13232.00 136.00 13232 136
As shown above, the average number of disk transfers per second is about 400; the disk reads about 5 MB per second, and writes about 1 MB.
Iostat-D-X-K 1 Device: rrqm /S wrqm/s r/S W /S rsec/s wsec/s RKb/s WKB/s avgrq-SZ avgqu-SZ await svctm % Utilsda 1.56 28.31 7.84 31.50 43.65 3.16 21.82 1.58 1.19 0.03 0.80 2.61 10.29 SDA 1.98 24.75 419.80 6.93 13465.35 253.47 6732.67 126.73 32.15 2.00 4.70 2.00 85.25 SDA 3.06 41.84 444.90 54.08 14204.08 2048.98 7102.04 1024.49 32.57 2.10 4.21 1.85 92.24
The average response time of the disk is <5 ms, and the disk usage is> 80. The disk response is normal, but it is busy.
From http://www.orczhou.com/index.php/2010/03/iostat-detail/