I/O usage analyses: iostat

Performance Diagnosis
Technical articles
iostat
uses information from the following files:
  • /proc/stat (system statistics)
  • /proc/uptime contains system uptime)
  • /proc/partitions (disk statistics for pre 2.5 kernels that have been patched)
  • /proc/diskstats (disk statistics for post 2.5 kernels)
  • /sys (statistics for block devices for post 2.5 kernels)
  • /proc/self/mountstats (statistics for network filesystems)
I/O analyses with iostat

iostat provides the most complete view of disk I/O performance including:
  • a per-device and per-partition breakdown of how many blocks are written to and from a particular disk
  • information on how a disk is being utilized
  • information on how long Linux waits to submit requests to the disk

vmstat provides some basic statistics and should be used first when iostat is not available

The iostat command:
iostat [-d] [-k] [-x] [device] [interval count]]

Important Command line options:
  • -d: Display the device utilization report.
  • -k: Display statistics in kilobytes per second instead of blocks per second.  
  • -x: Display extended statistics. Does not work with all versions of the Linux kernel.
  • device: if specified, will show only statistics for this device
  • interval: Length of time between samples.
  • count: The total number of samples to take.

Default Output
The default output from iostat includes these statistics:
  • tps: 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: 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: the amount of data written to the device expressed in a number of blocks per second.
  • Blk_read: total number of blocks read.

Extended disk statistics.
The output from iostat -x includes these statistics:
  • rrqm/s: number of read requests merged per second that were queued to the device.
  • wrqm/s: number of write requests merged per second that were queued to the device.
  • r/s: number of read requests that were issued to the device per second.
  • w/s: number of write requests that were issued to the device per second.
  • rsec/s: number of sectors read from the device per second.
  • wsec/s: number of sectors written to the device per second.
  • rkB/s: number of kilobytes read from the device per second.
  • wkB/s: number of kilobytes written to the device per second.
  • rMB/s: number of megabytes read from the device per second.
  • wMB/s: number of megabytes written to the device per second.
  • avgrq-sz: average size (in sectors) of the requests that were issued to the device.
  • avgqu-sz: average queue length of the requests that were issued to the device.
  • await: 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: average service time (in milliseconds) for I/O requests that were issued to the device. (May be removed from future versions).



Suggestions for Future Learning
This information will be in the second edition of UNIX For Application Support Staff . The ETA for the second edition is December 1, 2016.



Performance Diagnosis
Technical articles