Iostat for Linux hard disk I/O performance

Source: Internet
Author: User

Install iostat on centos

# Yum install sysstat


This parameter has never been used before. Now I have carefully studied iostat, because there is a high pressure on an important server, so let's take a look at it. below is the server with too much Io pressure.

$iostat -x 1Linux 2.6.33-fukai (fukai-laptop)          _i686_    (2 CPU)avg-cpu:  %user   %nice %system %iowait  %steal   %idle           5.47    0.50    8.96   48.26    0.00   36.82 Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %utilsda               6.00   273.00   99.00    7.00  2240.00  2240.00    42.26     1.12   10.57   7.96  84.40sdb               0.00     4.00    0.00  350.00     0.00  2068.00     5.91     0.55    1.58   0.54  18.80

Rrqm/s:The number of merge read operations per second. That is, Delta (rmerge)/s
Wrqm/s:The number of write operations performed by merge per second. That is, Delta (wmerge)/s
R/S:The number of read I/O devices per second. That is, Delta (Rio)/s
W/s:The number of write I/O devices per second. That is, Delta (WIO)/s
Rsec/s:Number of read sectors per second. That is, Delta (rsect)/s
Wsec/s:Number of write sectors per second. That is, Delta (wsect)/s
RKb/s:The number of bytes read per second. It is half of rsect/s because the size of each slice is 512 bytes. (Computing required)
WKB/s:Number of bytes written per second. Half of wsect/s. (Computing required)
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:The average wait time (in milliseconds) for each device I/O operation ). That is, Delta (ruse + wuse)/DELTA (Rio + WIO)
Svctm:The average service time (in milliseconds) for each device I/O operation ). That is, Delta (use)/DELTA (Rio + WIO)
% Util:The amount of time in one second is used 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)

If % util is close to 100%, it indicates that too many I/O requests are generated and the I/O system is fully loaded.
There may be bottlenecks.
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 determine the read speed by avgqu-SZ × (R/S or W/S) = rsec/s or wsec/s.

For more information, see
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.


A good example for others (I/O system vs. Supermarket Queue)

For example, how can we decide which payment platform to pay when queuing for checkout at the supermarket? First, let's look at the number of people in the queue. is the total number of five people faster than 20? In addition to the number of people, we often look at the number of items purchased by the previous person. If there is a big mom who has purchased food for a week, we can consider changing the team. There is also the cashier's speed. If you have a newbie who doesn't even know about the money, you will have to wait. In addition, the timing is also very important. It may be 5 minutes ago, but the money was crowded, and now people go to the building, but it is refreshing to pay the money. Of course, the premise is that what has been done in the past five minutes is more meaningful than queuing (but I have not found anything boring than queuing ).

I/O systems have many similarities with supermarket Queues:

R/S + w/s is similar to the total number of payers
The average queue length (avgqu-sz) is similar to the number of average queues per unit time.
The average service time (svctm) is similar to the cashier's collection speed
The average wait time (await) is similar to the average wait time of each person
Average I/O data (avgrq-sz) is similar to the average number of items bought by each person
The I/O operation rate (% util) is similar to the time ratio in which someone queues before the cashier.

We can analyze the I/O Request mode and the I/O speed and response time based on the data.

The following is an analysis of the output of this parameter written by someone else.

# iostat -x 1avg-cpu: %user %nice %sys %idle16.24 0.00 4.31 79.44Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm %util/dev/cciss/c0d00.00 44.90 1.02 27.55 8.16 579.59 4.08 289.80 20.57 22.35 78.21 5.00 14.29

The iostat output above indicates that 28.57 device I/O operations are performed in seconds: Total IO/S = R/S (read) + w/s (write) = 1.02 + 27.55 = 28.57 (times/second), where the write operation occupies the main body (W: r = 27 ).

On average, only 5 ms is required for each device I/O operation, but 78 MS is required for each I/O request. Why? Because too many I/O requests are sent (about 29 requests per second), assuming these requests are sent at the same time, the average wait time can be calculated as follows:

Average wait time = single I/O service time * (1 + 2 +... + Requests-1)/Total requests

Application to the above example: average wait time = 5 ms * (1 + 2 +... + 28)/29 = 70 ms, which is very close to the average waiting time of 78 MS given by iostat. This in turn indicates that I/O is initiated at the same time.

There are many I/O requests per second (about 29), but the average queue is not long (only about 2). This indicates that the arrival of these 29 requests is uneven, i/O is idle most of the time.

In one second, 14.29% of the time I/O queues have requests. That is to say, the I/O system has nothing to do in 85.71% of the time, all 29 I/O requests are processed within 142 milliseconds.

Delta (ruse + wuse)/DELTA (IO) = await = 78.21 => delta (ruse + wuse)/S = 78.21 * delta (IO) /S = 78.21*28.57 = 2232.8, indicating that I/O requests per second need to wait for a total of 2232.8 Ms. Therefore, the average queue length should be 2232.8 ms/1000 ms = 2.23, while the average queue length (avgqu-sz) provided by iostat is 22.35. Why ?! Because there is a bug in iostat, The avgqu-SZ value should be 2.23 instead of 22.35.

From: http://www.php-oa.com/2009/02/03/iostat.html

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.