Linux I/O Performance measurements with iostat
The iostat monitoring tool provides input/output statistics for devices, partititions and network file-systems (NFS). Furthermore, CPU statistics are also output. Iostat is part of the sysstat package.
Basics of iostat
iostat outputs values and is typically called up with two numeric parameters:
- Example:
iostat 1 5- 1 ->The values are measured and output every second.
- 5 -> The values are output 5 times and the program will be terminated after this.
The first output line contains the average values since the last reboot. All other output lines represent the current values. iostat requires no special user rights. Therefore, it is possible to execute it as normal user.
user@ubuntu-9-10:~$ iostat -x 1 5
Linux 2.6.31-20-generic-pae (ubuntu-9-10) 04/08/2010 _i686_ (4 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
2.38 0.07 0.66 0.39 0.00 96.51
Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 6.93 131.80 85.02 1347350 869177
avg-cpu: %user %nice %system %iowait %steal %idle
7.95 0.00 2.65 6.27 0.00 83.13
Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 340.00 2720.00 0.00 2720 0
avg-cpu: %user %nice %system %iowait %steal %idle
7.19 0.00 4.32 5.76 0.00 82.73
Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 440.59 3524.75 0.00 3560 0
[...]
Options from iostat
iostat
The standard output looks like this without special parameters:
user@ubuntu-9-10:~$ iostat
Linux 2.6.31-20-generic-pae (ubuntu-9-10) 04/08/2010 _i686_ (4 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
2.38 0.07 0.66 0.39 0.00 96.50
Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 7.19 130.01 87.95 1380622 933921
user@ubuntu-9-10:~$
iostat -x
The option -x provides extended statistics:
user@ubuntu-9-10:~$ iostat -x
Linux 2.6.31-20-generic-pae (ubuntu-9-10) 04/08/2010 _i686_ (4 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
2.38 0.07 0.66 0.39 0.00 96.50
Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util
sda 2.05 8.14 4.31 2.87 129.76 87.85 30.31 0.13 18.47 3.13 2.25
user@ubuntu-9-10:~$
iostat -d
The -d option only shows device-statistics (no CPU-statistics):
user@ubuntu-9-10:~$ iostat -d Linux 2.6.31-20-generic-pae (ubuntu-9-10) 04/08/2010 _i686_ (4 CPU) Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn sda 7.18 129.63 87.83 1380622 935433 user@ubuntu-9-10:~$
iostat -c
The -c option only shows CPU-statistics (no device-statistics):
user@ubuntu-9-10:~$ iostat -c
Linux 2.6.31-20-generic-pae (ubuntu-9-10) 04/08/2010 _i686_ (4 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
2.38 0.07 0.66 0.39 0.00 96.50
user@ubuntu-9-10:~$
Meaning of the individual values
(source man iostat)
CPU Utilization Report
- %user: Show the percentage of CPU utilization that occurred while executing at the user level (application).
- %nice: Show the percentage of CPU utilization that occurred while executing at the user level with nice priority.
- %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 outstanding disk I/O request.
- %steal: Show the percentage of time spent in involuntary wait by the virtual CPU or CPUs while the hypervisor 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 outstanding disk I/O request.
Device Utilization Report
- Device: This column gives the device (or partition) name
- 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 the 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. With 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 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.
- %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
- Filesystem: This columns shows the hostname of the NFS server followed by a colon and by the directory name where the network filesystem is mounted.
- 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.
More information
- http://www.igvita.com/2009/06/23/measuring-optimizing-io-performance/
- http://mituzas.lt/2009/03/11/iostat/
- http://jcole.us/blog/archives/2007/05/08/on-iostat-disk-latency-iohist-onward/
- http://www.pythian.com/news/247/basic-io-monitoring-on-linux/
|
Author: Werner Fischer Werner Fischer, working in the Knowledge Transfer team at Thomas-Krenn, completed his studies of Computer and Media Security at FH Hagenberg in Austria. He is a regular speaker at many conferences like LinuxTag, OSMC, OSDC, LinuxCon, and author for various IT magazines. In his spare time he enjoys playing the piano and training for a good result at the annual Linz marathon relay.
|
|
Translator: Alina Ranzinger Alina has been working at Thomas-Krenn.AG since 2024. After her training as multilingual business assistant, she got her job as assistant of the Product Management and is responsible for the translation of texts and for the organisation of the department.
|


