Iostat: ReportCentralProcessingUnit (CPU) statisticsandinputoutputstatisticsfordevicesandpartitions: collects the CPU status information about devices and partitions. [root @ billtest ~] I iostat: Report Central Processing Unit (CPU) statistics and input/output statistics for devices and partitions
[root@billtest ~]# iostatLinux 2.6.18-194.el5 (billtest) 01/09/2014avg-cpu: %user %nice %system %iowait %steal %idle 8.84 0.17 1.26 1.57 0.00 88.17Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtnsda 21.41 2.04 399.41 39733155 7797825326sda1 0.00 0.00 0.00 1623 78sda2 0.00 0.09 0.13 1790370 2594176sda3 1.69 0.48 53.17 9389146 1038079184sda4 0.00 0.00 0.00 10 0sda5 0.01 0.04 0.45 865722 8729848sda6 5.93 0.63 70.24 12299666 1371347704sda7 13.77 0.79 275.42 15386170 5377074336sdb 0.10 0.37 2.48 7227786 48461024
Explanation of display results: % user-level applications current CPU usage % nice user-level good priority CPU usage % system-level CPU usage % iowait system output data to disk space-time idle CPU time percentage (I/O wait) % steal % idle system does not have any data output to disk CPU time percentage (idle time) device tps the number of transfers per second of the device, one transmission I/O Blk_read/s read from the device per second Blk_wrtn/s-the total data volume written to the device Blk_read per second Blk_wrtn total data volume written
Command parameters: -c: displays the CPU statistics. x-d: displays the usage status of the Device.-k. some major powers that use block as the unit use Kilobytes as the unit.-x provides more status parameters. Device:
Iostat-d-x 1 3 Note: the parameters of the following two numbers are displayed once per second and three times. Frequency, one is the total display times rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm % utilsda 0.00 39.00 0.00 4.00 0.00 172.00 86.00 0.06 14.50 10.50 4.20sda1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00sda2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00sda3 0.00 0.00 0.00 0.00 39.00 0.00 4.00 0.00 172.00 4.20sda4 86.00 0.06 14.50 10.50 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00sda5 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00sda6 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00sda7 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 0.00sdb 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Rrqm/s: Number of merge read operations per second. delta (rmerge)/swrqm/s: Number of merge write operations per second. that is, delta (wmerge)/sr/s: the number of read I/O devices completed per second. that is, delta (rio)/sw/s: the number of write I/O devices completed per second. that is, delta (wio)/srsec/s: Number of read sectors per second. that is, delta (rsect)/swsec/s: number of write sectors per second. that is, delta (wsect)/srkB/s: the number of K bytes read per second. it is half of rsect/s because the size of each slice is 512 bytes. (to be calculated) wkB/s: number of K bytes written per second. half of wsect/s. avgrq-sz: average data size (slice) of each device I/O operation ). delta (rsect + wsect)/delta (rio + wio) avgqu-sz: average I/O queue length. that is, delta (aveq)/s/1000 (because aveq is measured in milliseconds ). await: average wait time (milliseconds) for each device I/O operation ). that is, delta (ruse + wuse)/delta (rio + wio) svctm: average service time per device I/O operation (MS ). that is, delta (use)/delta (rio + wio) % util: the percentage of time in one second for I/O operations, or the number of I/O queues in one second is not empty. that is, delta (use)/s/1000 (because the unit of use is milliseconds)
Common usage: $ iostat-d-k 1 10 # View TPS and throughput information iostat-d-x-k 1 10 # View device usage (% util), response time (await) iostat-c 1 10 # View cpu status
Read the displayed report: If % util is close to 100%, it indicates that too many I/O requests are generated, and the I/O system is fully loaded, the disk may have a bottleneck. when the idle is less than 70% I/O, the load is high. Generally, the read speed is wait. you can also view the parameters B (number of processes waiting for resources) and wa in combination with vmstat (percentage of CPU time occupied by I/O wait, higher than 30% when I/O pressure is high) in addition, await parameters must be referenced by svctm. IO problems may occur if the difference is too high. avgqu-sz is also a place to note when performing IO optimization. this is the data size of each operation. if the number of times is large but the data size is small, in fact, IO will be very small. if the data is big, the IO Data will be high. you can also use avgqu-sz × (r/s or w/s) = rsec/s or wsec/s. that is to say, the speed of reading is determined by this.
Generally, svctm is smaller than await (because the wait time for simultaneously waiting requests is calculated repeatedly). The size of svctm is generally related to disk performance, and the CPU/memory load will also affect it, too many requests may indirectly increase the svctm. the size of await generally depends on the service time (svctm), the length of the I/O queue, and the mode in which I/O requests are sent. if svctm is close to await, it means that I/O has almost no waiting time. if await is much larger than svctm, it means that the I/O queue is too long and the response time of the application is slow, if the response time exceeds the allowable range, you can consider replacing a faster disk, adjusting the kernel elevator algorithm, optimizing the application, or upgrading the CPU. the queue length (avgqu-sz) can also be used as an indicator to measure the system I/O load. However, because avgqu-sz is based on the average per unit time, therefore, it cannot reflect the instantaneous I/O flood.
Reference: 1 Linux man iostat2 http://www.ha97.com/4546.html