Use iostat in Linux to monitor the I/O status

Source: Internet
Author: User
Tags disk usage

Use iostat in Linux to monitor the I/O status

In Linux, we can use sar (1), pidstat (1), mpstat (1), and vmstat (8) to monitor the I/O status.

I. Installation

Yum install sysstat

Ii. Parameter explanation

FILES

/Proc/stat contains system statistics.

/Proc/uptime contains system uptime.

/Proc/partitions contains disk statistics (for pre 2.5 kernels that have been patched ).

/Proc/diskstats contains disks statistics (for post 2.5 kernels ).

/Sys contains statistics for block devices (post 2.5 kernels ).

/Proc/self/mountstats contains statistics for network filesystems.

/Dev/disk contains persistent device names.

CPU Utilization Report

% User Show the percentage of CPU utilization that occurred while executing at the user level (applica-tion ).

% Nice Show the percentage of CPU utilization that occurred while executing at the user level with nicepriority.

% System Show the percentage of CPU utilization that occurred while executing at the system level (kernel ).

% Iowait Show the percentage of time that the CPU or CPUs were idle during which the system had an outstand-ing disk I/O request.

% Steal Show the percentage of time spent in involuntary wait by the virtual CPU or CPUs while the hypervi-sor was servicing another virtual processor.

% Idle Show the percentage of time that the CPU or CPUs were idle and the system did not have an outstand-ing disk I/O request.

Device Utilization Report

Tps Indicate the number of transfers per second that were issued to the device. A transfer is an I/O

Request to the device. Multiple logical requests can be combined into a single I/O request to

Device. A transfer is of indeterminate size.

 

Blk_read/s Indicate the amount of data read from the device expressed in a number of blocks per second. Blocks

Are equivalent to sectors with kernels 2.4 and later and therefore have a size of 512 bytes.

Older kernels, a block is of indeterminate size.

 

Blk_wrtn/s Indicate the amount of data written to the device expressed in a number of blocks per second.

Blk_read The total number of blocks read.

Blk_wrtn The total number of blocks written.

KB_read/s Indicate the amount of data read from the device expressed in kilobytes per second.

KB_wrtn/s Indicate the amount of data written to the device expressed in kilobytes per second.

KB_read The total number of kilobytes read.

KB_wrtn The total number of kilobytes written.

MB_read/s Indicate the amount of data read from the device expressed in megabytes per second.

MB_wrtn/s Indicate the amount of data written to the device expressed in megabytes per second.

MB_read The total number of megabytes read.

MB_wrtn The total number of megabytes written.

Rrqm/s The number of read requests merged per second that were queued to the device.

Wrqm/s The number of write requests merged per second that were queued to the device.

R/s The number of read requests that were issued to the device per second.

W/s The number of write requests that were issued to the device per second.

Rsec/s The number of sectors read from the device per second.

Wsec/s The number of sectors written to the device per second.

RkB/s The number of kilobytes read from the device per second.

WkB/s The number of kilobytes written to the device per second.

RMB/s The number of megabytes read from the device per second.

WMB/s The number of megabytes written to the device per second.

Avgrq-sz The average size (in sectors) of the requests that were issued to the device.

Avgqu-sz The average queue length of the requests that were issued to the device.

Await The average time (in milliseconds) for I/O requests issued to the device to be served. This includes des the time spent by the requests in queue and the time spent servicing them.

Svctm The average service time (in milliseconds) for I/O requests that were issued to the device. Warning! Do not trust this field any more. This field will be removed in a future sysstat version.

% Util Percentage of CPU time during which I/O requests were issued to the device (bandwidth utilization for the device). Device saturation occurs when this value is close to 100%.

Network Filesystem report

RBlk_nor/s Indicate the number of blocks read by applications via the read (2) system call interface. A block has a size of 512 bytes.

WBlk_nor/s Indicate the number of blocks written by applications via the write (2) system call interface.

RBlk_dir/s Indicate the number of blocks read from files opened with the O_DIRECT flag.

WBlk_dir/s Indicate the number of blocks written to files opened with the O_DIRECT flag.

RBlk_svr/s Indicate the number of blocks read from the server by the NFS client via an nfs read request.

WBlk_svr/s Indicate the number of blocks written to the server by the NFS client via an nfs write request.

RkB_nor/s Indicate the number of kilobytes read by applications via the read (2) system call interface.

WkB_nor/s Indicate the number of kilobytes written by applications via the write (2) system call interface.

RkB_dir/s Indicate the number of kilobytes read from files opened with the O_DIRECT flag.

WkB_dir/s Indicate the number of kilobytes written to files opened with the O_DIRECT flag.

RkB_svr/s Indicate the number of kilobytes read from the server by the NFS client via an nfs read request.

WkB_svr/s Indicate the number of kilobytes written to the server by the NFS client via an nfs write request.

RMB _nor/s Indicate the number of megabytes read by applications via the read (2) system call interface.

WMB_nor/s Indicate the number of megabytes written by applications via the write (2) system call interface.

RMB _dir/s Indicate the number of megabytes read from files opened with the O_DIRECT flag.

WMB_dir/s Indicate the number of megabytes written to files opened with the O_DIRECT flag.

RMB _svr/s Indicate the number of megabytes read from the server by the NFS client via an NFS READ request.

WMB_svr/s Indicate the number of megabytes written to the server by the NFS client via an nfs write request.

Ops/s Indicate the number of operations that were issued to the filesystem per second.

Rops/s Indicate the number of 'read' operations that were issued to the filesystem per second.

Wops/s Indicate the number of 'write' operations that were issued to the filesystem per second.

Command Parameters

-C: CPU usage

-D: Display disk usage

-K is displayed in KB.

-M is displayed in MB.

-N: Display disk array (LVM) Information

-N: displays NFS usage

-P [disk]: displays the disk and partition information.

-T display terminal and CPU Information

-X: displays details.

-V: display version information


Iii. Usage

Device Utilization Report

[Root @ localhost ~] # Iostat-d-k 2 4

Linux 2.6.32-431.11.2.el6.x86 _ 64 (localhost) 01/08/2016 _ x86_64 _ (4 CPU)

 

Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn

X vda 114.22 13.80 713.21 372234513 19241775188

Xvdb 19.26 21.24 144.25 573067009

 

Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn

Xvda 0.00 0.00 0.00 0 0

Xvdb 4.50 0.00 18.00 0 36

 

Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn

Xvda 0.00 0.00 0.00 0 0

Xvdb 10.50 0.00 42.00 0 84

 

Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn

Xvda 0.00 0.00 0.00 0 0

Xvdb 20.50 0.00 86.00 0 172

Parameter description

  • Tps: the number of times the device transmits per second. Multiple logical requests can be combined into a single I/O Request device. Transmission has an uncertain size.
  • KB_read/s: the amount of data read from the device per second
  • KB_wrtn/s: data volume written to the device per second
  • KB_read: total data volume read
  • KB_wrtn: total data volume written

[Root @ localhost ~] # Iostat-d-x-k 1 10

Linux 2.6.32-431.11.2.el6.x86 _ 64 (localhost) 01/08/2016 _ x86_64 _ (4 CPU)

 

Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm % util

Xvda 0.02 0.69 0.56 113.65 13.80 713.21 12.73 0.00 0.03 0.48 5.53

Xvdb 0.02 17.88 1.07 18.19 21.24 144.27 17.19 0.13 6.71 1.69

 

Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm % util

Xvda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00

Xvdb 0.00 0.00 0.00 5.00 0.00 20.00 8.00 0.11 22.00 4.40

Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm % util

Xvda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00

Xvdb 0.00 0.00 0.00 16.00 0.00 64.00 8.00 0.80 50.19 6.81

Total IO (io)/s = r/s (read) + w/s (write)

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

Parameter description

  • Rrqm/s: the number of merge read operations per second. That is, delta (rmerge)/s.
  • Wrqm/s: Number of write operations performed on merge per second. That is, delta (wmerge)/s
  • R/s: The number of read I/O devices completed per second. That is, delta (rio)/s.
  • W/s: the number of write I/O devices completed 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 K Bytes read per second. It is half of rsect/s, because the size of each sector is 512 bytes. (calculated)
  • WkB/s: the number of K bytes written per second. Half of wsect/s (to be calculated)
  • 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 for each device I/O operation (MS). That is, delta (ruse + wuse)/delta (rio + wio)
  • Svctm: Average service time for each 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)

If % util is close to 100%, it indicates that too many I/O requests are generated and the I/O system is fully loaded. This disk may have a bottleneck.
If the idle is less than 70% I/O, the load will be high. Generally, wait provides a high read speed.

Avgqu-sz indicates the data size of each operation. If the number of operations is large but the data size is small, the IO size will be small. if the data size is large, the IO data will be high, through avgqu-sz × (r/s or w/s) = rsec/s or wsec/s

CPU Utilization Report

[Root @ localhost ~] # Iostat-c 1 10

Linux 2.6.32-431.11.2.el6.x86 _ 64 (localhost) 01/08/2016 _ x86_64 _ (4 CPU)

 

Avg-cpu: % user % nice % system % iowait % steal % idle

5.09 0.00 2.08 4.28 0.00 88.55

 

Avg-cpu: % user % nice % system % iowait % steal % idle

1.75 0.00 0.50 0.00 0.00 97.75

 

Avg-cpu: % user % nice % system % iowait % steal % idle

1.50 0.00 0.50 0.00 0.00 98.00

 

Avg-cpu: % user % nice % system % iowait % steal % idle

0.25 0.00 0.25 0.00 0.00 99.50


Parameter description

  • % User: Percentage of CPU time in user mode
  • % Nice: Percentage of CPU time in user mode with NICE Value
  • % System: Percentage of CPU time in system Mode
  • % Iowait: Percentage of CPU waiting for input/output completion time
  • % Steal: Percentage of unconscious waiting time of the virtual CPU when the hypervisor maintains another virtual processor
  • % Idle: Percentage of idle CPU time

If % iowait is too high, it indicates that the hard disk has an I/O bottleneck and % idle is too high, indicating that the CPU is idle.

If the value of % idle is high but the system response is slow, it may be that the CPU is waiting for memory allocation. In this case, the memory capacity should be increased. If the value of % idle is lower than 10, the CPU processing capability of the system is relatively low, indicating that the most important resource in the system is the CPU

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

RH442 strategy-iostat

Use the iostat command in Linux to generate a statistical report on CPU and I/O

Install iostat and mpstat

Brief description of Linux iostat command output

Linux iostat command

Linux iostat command instance details

Detailed description of iostat commands

This article permanently updates the link address:

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.