Linux uses iostat to analyze IO performance and linuxiostatio Performance

Source: Internet
Author: User

Linux uses iostat to analyze IO performance and linuxiostatio Performance

Original article: http://www.cnblogs.com/bangerlee/articles/2547161.html

For I/O-bond processes, we often use iostat to view the number of IO requests issued by processes and the time consumed by the system to process IO requests, then, analyze whether there is a bottleneck in IO during the interaction between the Process and the operating system.

The following example uses the iostat command to describe how to use iostat to view the delivery status of IO requests, the system's IO processing capability, and the meaning of each field in the command execution result.

1.Execute with no optionIostat

Let's first look at the output result of executing iostat:

linux # iostatLinux 2.6.16.60-0.21-smp (linux)     06/12/12avg-cpu:  %user   %nice %system %iowait  %steal   %idle           0.07    0.00    0.05    0.06    0.00   99.81Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtnsda               0.58         9.95        37.47    6737006   25377400sdb               0.00         0.00         0.00        824          0

Execute iostat separately. The result is the statistics from the system startup to the current execution time. In the above output, except for the line indicating the system version, host name, and date at the top, there are two parts:

Avg-cpu: Overall cpu usage statistics. For multi-core CPUs, here is the average of all CPUs.

Device: IO statistics for each disk device

 

For cpu statistics, we mainly look at the iowait value, which indicates the time when the cpu is used to wait for the completion of io requests. The meanings of each column in Device are as follows:

  • Device: Device name displayed in sdX format
  • Tps: Number of IO read/write requests sent by processes per second
  • Blk_read/s: Number of read sectors per second (one sector is 512 bytes)
  • Blk_wrtn/s: Number of write sectors per second
  • Blk_read: Total number of read sectors within the sampling interval
  • Blk_wrtn: Total number of write sectors within the sampling interval

We can use the-c option to separately display the avg-cpu part results, and use the-d option to separately display the Device part information.

 

2.Specify the sampling interval and number of samples

Like the sar command, we can use"Iostat interval [count]"To specify the sampling interval and number of times of the iostat command:

linux # iostat -d 1 2Linux 2.6.16.60-0.21-smp (linux)     06/13/12Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtnsda               0.55         8.93        36.27    6737086   27367728sdb               0.00         0.00         0.00        928          0Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtnsda               2.00         0.00        72.00          0         72sdb               0.00         0.00         0.00          0          0

The preceding command outputs the Device information. The sampling time is 1 second and the sampling time is 2. If no sampling frequency is specified, iostat always outputs the sampling information, press ctrl + c to exit the command. Note that the 1st sampling is the same as the iostat command, which is the statistical information from the system boot to the current execution time.

 

3.ToKBDisplay read/write information for units(-KOption)

We can use the-k option to specify that some output results of iostat are in kB rather than the number of sectors:

linux # iostat -d -kLinux 2.6.16.60-0.21-smp (linux)     06/13/12Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtnsda               0.55         4.46        18.12    3368543   13686096sdb               0.00         0.00         0.00        464          0

In the above output, the values of kB_read/s, kB_wrtn/s, kB_read, and kB_wrtn are in kB, compared with the number of sectors, here the value is half of the original value (1kB = 512bytes * 2)

 

4.More detailedIoStatistics(-XOption)

To display more detailed io Device statistics, we can use the-x option to enable the-x option when analyzing io bottlenecks:

linux # iostat -x -k -d 1Linux 2.6.16.60-0.21-smp (linux)     06/13/12……Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await  svctm  %utilsda               0.00  9915.00    1.00   90.00     4.00 34360.00   755.25    11.79  120.57   6.33  57.60

The meanings of the above columns are as follows:

  • Rrqm/s: The number of times the read requests to the device are merged per second. The file system will merge the requests to read the same block.
  • Wrqm/s: Number of write requests to the device merged per second
  • R/s: Number of completed reads per second
  • W/s: Number of completed writes per second
  • RkB/s: Read data volume per second (kB)
  • WkB/s: Write data volume per second (kB)
  • Avgrq-sz: Average data volume per IO operation (unit: Slice)
  • Avgqu-sz: Average length of the I/O Request queue waiting for processing
  • Await: Average waiting time for each IO request (including waiting time and processing time, in milliseconds)
  • Svctm: Average processing time of each IO request (in milliseconds)
  • % Util: The time ratio used for IO operations within the cycle, that is, the time ratio of non-null IO queues.

 

For the above sample output, we can obtain the following information:

 

There is also a relationship between the above values. We can calculate other values from some values, for example:

Util = (r/s + w/s) * (svctm/1000)

For the above example: util = (1 + 90) * (6.33/1000) = 0.57603


Iostat can test the storage performance.

No configuration 2 NO system 3 no software version 4 no log information 5 no test data, are you sure you are professional?
 
Linux iostat command

-X: Display extended statistics)
-K: The number of K Records per second. The unit is block/second.
-T: prints the time information for each result.
30: interval 30 seconds
20: Display Results 20 times in total

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.