View hard drive Load: Iostat command

Source: Internet
Author: User
Tags disk usage

The Iostat in a Linux system is an abbreviation for I/O statistics (input/output statistics), and the Iostat tool monitors the system's disk operation activity. It is characterized by the reporting of disk activity statistics, as well as the reporting of CPU usage. Like Vmstat, Iostat also has a weakness, that is, it cannot analyze a process in depth, only the overall situation of the system. Iostat belongs to the Sysstat package. can be used

yum-y Install Sysstat Direct Installation .
1. Command format:iostat[parameter [TIME] [number]2. Command function: through the Iostat convenient to view the CPU, network card, TTY device, disk, CD-ROM and other equipment activities, load information. 3. Command parameters:-C Display CPU Usage-D displays disk usage-m displays the-m in KB display-n Display disk array (LVM) information-N Display NFS usage-p[disk] display disk and partition condition-T display terminal and CPU information-X Show Details-V displays version information 4. Usage Example: instance 1: Show all device load conditions command: Iostat output:
[[email protected] ~]# iostatlinux 2.6.18-128.el5 (CT1186)   December 28, 2012 AVG-CPU:  %user%nice   %system% Iowait  %steal   %idle           8.30    0.02    5.07    0.17    0.00   86.44Device:            TPS   Blk_ read/s   blk_wrtn/s   blk_read   blk_wrtnsda              22.73        43.70       487.42  674035705 7517941952SDA1              0.00         0.00         0.00       2658        536sda2              0.11         3.74         3.51   57721595   54202216sda3              0.98         0.61        17.51    9454172  270023368sda4              0.00         0.00         0.00          6          0sda5              6.95         0.12       108.73    1924834 1677123536sda6              2.20         0.18        31.22    2837260  481488056sda7             12.48        39.04       326.45  602094508 5035104240
View Code
     
 cpu Property Value Description: The percentage of time%user:cpu in user mode. %nice:cpu the percentage of time in user mode with nice value. %system:cpu the percentage of time in system mode. %iowait:cpu the percentage of time to wait for the input output to finish. %steal: The percentage of the virtual CPU's unconscious wait time when the hypervisor maintains another virtualized processor. %IDLE:CPU idle time percentage. Note: If the value of%iowait is too high, indicating that there is an I/O bottleneck on the hard disk, high%idle value, indicating that the CPU is idle, if the%idle value is high but the system responds slowly, it is possible that the CPU waits for memory allocation, and the memory capacity should be increased. If the%idle value continues below 10, the system's CPU processing power is relatively low, indicating that the most resource to be addressed in the system is the CPU. Disk Property Value Description: rrqm/s: Number of read operations per second for merge. That is rmerge/swrqm/s: the number of write operations per second for the merge. That is wmerge/sr/s: the number of read I/O devices completed per second. That is, rio/sw/s: The number of write I/O devices completed per second. That is, wio/srsec/s: number of Read sectors per second. That is, rsect/swsec/s: number of Write sectors per second. That is wsect/srkb/s: Read 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. Avgqu-sz: Average I/O queue length. Await: The average wait time (in milliseconds) for each device I/O operation. SVCTM: The average service time (in milliseconds) per device I/O operation. %util: The amount of time in a second for I/O operations, which is CPU percent consumed by IO Note: If the%util is close to 100%, it indicates that there are too many I/O requests and that the I/O system is full, the disk may have bottlenecks. If the SVCTM is closer to await, it indicates that I/O has almost no wait time, and if the await is much larger than SVCTM, indicating that the I/O queue is too long and the IO response is too slow, the necessary optimizations are required. If the Avgqu-sz is larger, it also indicates that there is an equivalent IO waiting. 
View Code
Example 2: Timed display of all information commands: Iostat 2 3 output:
[[email protected] ~]# iostat 2 3Linux 2.6.18-128.el5 (CT1186) December 28, 2012 AVG-CPU:%user%nice%system%iowait %steal%idle 8.30 0.02 5.07 0.17 0.00 86.44device:tps blk_read/s BLK_WRTN/S Bl          K_read BLK_WRTNSDA 22.73 43.70 487.42 674035705 7517947296sda1 0.00 0.00              0.00 2658 536sda2 0.11 3.74 3.51 57721595 54202216sda3          0.98 0.61 17.51 9454172 270023608sda4 0.00 0.00 0.00 6    0sda5 6.95 0.12 108.73 1924834 1677125640sda6 2.20 0.18 31.22 2837260 481488152sda7 12.48 39.04 326.44 602094508 5035107144avg-cpu:%user%nice%system% Iowait%steal%idle 8.88 0.00 7.94 0.19 0.00 83.00device:tps blk_read/s Blk_wrt N/S Blk_read Blk_wrtNSDA 6.00 0.00 124.00 0 248sda1 0.00 0.00 0.00 0 0sda2 0.00 0.00 0.00 0 0sda3 0.00 0.              XX 0.00 0 0SDA4 0.00 0.00 0.00 0 0sda5          0.00 0.00 0.00 0 0SDA6 0.00 0.00 0.00 0   0SDA7 6.00 0.00 124.00 0 248avg-cpu:%user%nice%system%iowait%steal   %idle 9.12 0.00 7.81 0.00 0.00 83.07device:tps blk_read/s BLK_WRTN/S Blk_read         BLK_WRTNSDA 4.00 0.00 84.00 0 168SDA1 0.00 0.00         0.00 0 0SDA2 0.00 0.00 0.00 0 0sda3 0.00 0.00 0.00         0 0SDA4 0.00 0.00 0.00 0 0SDA5 0.00              0.00 0.00 0 0sda6 4.00 0.00 84.00 0 168SDA7  0.00 0.00 0.00) 0 0
View Code
Description
Refresh the display every 2 seconds and display 3 instances 3: Displays the specified disk information
command: iostat-d sda1 output:
[[email protected] ~]# iostat-d sda1linux 2.6.18-128.el5 (CT1186) December 28, 2012 Device:tps blk_read/s BLK_WRTN/S Blk_read blk_wrtnsda1 0.00 0.00 0.00 2658 536 Description: Instance 4: Show tty and CPU information life Order: Iostat-t Output: Copy code [[email protected] ~]# iostat-tlinux 2.6.18-128.el5 (CT1186) December 28, 2012 time:14 58 minutes 35 seconds Avg-cpu            :%user%nice%system%iowait%steal%idle 8.30 0.02 5.07 0.17 0.00 86.44Device: TPS blk_read/s blk_wrtn/s blk_read blk_wrtnsda 22.73 43.70 487.41 674035705 7517957864s DA1 0.00 0.00 0.00 2658 536sda2 0.11 3.74 3.51 57          721595 54202216sda3 0.98 0.61 17.51 9454172 270024344sda4 0.00 0.00              0.00 6 0sda5 6.95 0.12 108.73 1924834 1677128808sda6        2.20 0.1831.22 2837260 481488712sda7 12.48 39.04 326.44 602094508 5035113248  
View Code
Example 5: Display all information in M command: iostat-m output:
[[email protected] ~]# iostat-mlinux 2.6.18-128.el5 (CT1186)   December 28, 2012 AVG-CPU:  %user%nice   %system% Iowait  %steal   %idle           8.30    0.02    5.07    0.17    0.00   86.44Device:            TPS    mb_ read/s    mb_wrtn/s    mb_read    mb_wrtnsda              22.72         0.02         0.24     329119    3670881sda1              0.00         0.00         0.00          1          0sda2              0.11              0.00 0.00 28184 26465sda3 0.98         0.00         0.01       4616     131848sda4              0.00         0.00         0.00          0          0sda5              6.95         0.00         0.05        939     818911sda6              2.20         0.00         0.02       1385     235102sda7             12.48         0.02         0.16     293991    
View Code
Example 6: View TPS and Throughput Information command: iostat-d-K 1 1 output:
[[email protected] ~]# iostat-d-K 1 1Linux 2.6.18-128.el5 (CT1186)   December 28, 2012 device:            TPS    kb_read/s    KB_WRTN/S    kb_read    kb_wrtnsda              22.72        21.85       243.71  337017916 3758984340sda1              0.00         0.00         0.00       1329        268sda2              0.11         1.87         1.76   28860797   27101108sda3              0.98         0.31         8.75    4727086  135012508sda4              0.00         0.00         0.00          3          0sda5              6.95         0.06        54.37     962481  838566148sda6              2.20         0.09        15.61    1418630  240744712sda7             12.48        19.52       163.22  
View Code
Description
TPS: The number of transmissions per second of the device (indicate, transfers per second, were issued to the.). "One-time transfer" means "one-time I/O request". Multiple logical requests may be merged into "one I/O request". The size of the "one transfer" request is unknown. KB_READ/S: The amount of data read from the device (drive expressed) per second, KB_WRTN/S: The amount of data written to the device (drive expressed) per second, Kb_read: Total amount of data read, KB_WRTN: Total amount of data written ; These units are kilobytes. In the example above, we can see statistics on the disk SDA and its partitions, when the total disk TPS for statistics is 22.73, and the following is the TPS for each partition. (because it is an instantaneous value, the total TPS is not strictly equal to the sum of each partition TPs)
View Code
Example 7: View device Utilization (%UTIL), Response time (await) command: iostat-d-x-k 1 1 output:
[[email protected] ~]# iostat-d-x-k 1 1Linux 2.6.18-128.el5 (CT1186) December 28, 2012 device:rrqm/s wrqm/s   r/s w/s rkb/s wkb/s avgrq-sz avgqu-sz await SVCTM%utilsda 0.44 38.59 0.40 22.32 21.85     243.71 23.37 0.04 1.78 4.20 9.54sda1 0.00 0.00 0.00 0.00 0.00 0.00 18.90   0.00 8.26 6.46 0.00sda2 0.36 0.43 0.11 0.01 1.87 1.76 63.57 0.01 63.75 1.94              0.02sda3 0.00 1.24 0.04 0.95 0.31 8.75 18.42 0.04 39.77 8.73 0.86sda4 0.00 0.00 0.00 0.00 0.00 0.00 2.00 0.00 19.67 19.67 0.00sda5 0.00 6.65 0.0 0 6.94 0.06 54.37 15.67 0.26 36.81 4.48 3.11sda6 0.00 1.71 0.01 2.19 0.09 1 5.61 14.29 0.03 12.40 5.84 1.28sda7 0.08 28.56 0.25 12.24 19.52 163.22 29.28 0.2 7 21.46 5.00 6.25Copy code Description: rrqm/s: The number of read operations per second for the merge. Delta (rmerge)/swrqm/s: The number of write operations per second for the merge. That is, Delta (wmerge)/SR/S: The number of read I/O devices completed per second. That is Delt A (RIO)/sw/s: Number of write I/O devices completed per second. Delta (wio)/SRSEC/S: Number of Read sectors per second. Delta (rsect)/swsec/s: Number of Write sectors per second. Delta (wsect)/srkb/s: Read K bytes per second . is half of the rsect/s because the size of each sector is 512 bytes. (calculation required) wkb/s: writes K bytes per second. It's half the wsect/s. AVGRQ-SZ: The data size (sector) of the average 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 Per device I/O operation in milliseconds. That is, the delta (use )/delta (rio+wio)%util: How much time per second is spent on I/O operations, or how many times in a second I/O queues are non-empty, that is, Delta (use)/s/1000 (because the use is in milliseconds) if%util is close to 100%, Indicates that there are too many I/O requests, the I/O system is full, and the disk may have bottlenecks. Idle less than 70% io pressure is larger, the general reading speed has more wait. You can also combine vmstat to see the b parameter (the number of processes waiting on the resource) and the WA parameter (the percentage of CPU time that IO waits, which is higher than 30% when the IO pressure is high). In addition to await the parameters are more and SVCTM to reference. If the difference is too high, there must be an IO problem. Avgqu-sz is also an IO tuning need to pay attention to, this is the direct operation of the size of the data, if the number of times, but the small amount of data, in fact, IO will be very small. If the data is large, the IO data will be high. You can also pass AVGQU-SZX (r/s or w/s) = RSEC/S or wsec/s. That is to say, the speed of reading is determined by this. SVCTM are generally smallTo await (because the waiting time for waiting requests is repeatedly computed), the size of the SVCTM is generally related to disk performance, cpu/memory load will have an impact on it, too many requests will indirectly lead to SVCTM increase. The size of an 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 the SVCTM is closer to await, stating that I/O has almost no waiting time, if the await is much larger than SVCTM, the I/O queue is too long, the response time of the application gets slower, and if the response time exceeds the allowable range of the user, consider replacing the faster disk and adjusting the kernel Elev Ator algorithm, optimize the application, or upgrade the CPU.       The queue Length (AVGQU-SZ) can also be used as an indicator for measuring the system I/O load, but because Avgqu-sz is averaged over a unit time, it does not reflect instantaneous I/O flooding. Image analogy: r/s+w/s similar to the total number of people in the payment average queue Length (AVGQU-SZ) is similar to the average number of queues per unit of time (SVCTM) is similar to the average waiting time (await) of the cashier, similar to the average  The average waiting time per person I/O data (AVGRQ-SZ) is similar to how much I/O operation rate (%util) is similar to the average number of times a person is in a queue at the front of the payee device IO operation: Total io (IO)/s = r/s (read) +w/s (write) =1.46 + 25.28=26.74 average per Device I/O operation takes only 0.36 milliseconds to complete, now it takes 10.57 milliseconds to complete because there are too many requests (26.74 per second), and if the request is made at the same time, the average wait time can be calculated as: Average wait Time = single I/O server time * (total number of 1+2+...+ requests-1)/The total number of requests per second i/0 a lot of requests, but the average queue of 4, indicating that these requests are more uniform, most of the processing is more timely.
View Code
   Example 8: View CPU Status   command:    iostat-c 1 3   output:
[[email protected] ~]#  iostat-c 1 3Linux 2.6.18-128.el5 (CT1186)   December 28, 2012 AVG-CPU:  %user   %nice% System%iowait  %steal   %idle           8.30    0.02    5.07    0.17    0.00   86.44AVG-CPU:  %user   %nice%system%iowait  %steal   %idle           8.64    0.00    5.38    0.00    0.00   85.98avg-cpu:  %user   %nice%system%iowait  %steal%idle 7.62    0.00    5.12    0.50    0.00   86.75
View Code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.