Iostat

From Dikapedia
Jump to: navigation, search


iostat - Report Central Processing Unit (CPU) statistics and input/output statistics for devices and partitions.


$ iostat
Linux 4.14.158-129.185.amzn2.x86_64 (ip-172-31-33-239.ec2.internal) 	02/24/2020 	_x86_64_	(2 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.15    0.00    0.11    0.01    0.04   99.70

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
nvme0n1           0.86         2.81         5.86    3308340    6902350
$ iostat -xm
Linux 4.14.193-149.317.amzn2.x86_64 (ip-172-31-35-82.ec2.internal)      03/04/21        _x86_64_        (2 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.22    0.00    0.09    0.01    0.06   99.63

Device:         rrqm/s   wrqm/s     r/s     w/s    rMB/s    wMB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
nvme0n1           0.00     0.03    0.01    0.99     0.00     0.01    20.23     0.00    0.65    0.78    0.65   0.12   0.01


  • Tps : lists the transfers per second to the device. “Transfers” is another way to say I/O requests sent to the device.
  • Blk_read/s : The number of blocks read from the device per second.
  • Blk_wrtn/s : The number of blocks written to the device per second.
  • Blk_read : The total number of blocks read from the device.
  • Blk_wrtn : The total number of blocks written to the device.


You can use iostat to determine which drive partition is currently under heavy I/O load.


Once you have determined the drive partition that is under heavy I/O load, next is to identify whether the I/O is mostly from reads or writes.

  • Side note: you may have to run iostat more than one time to get an accurate sense of the current I/O on your system.
    • $ iostat n ; will print output every ‘n’ seconds. For example:
# Prints every 2 seconds
$ iostat 2
Linux 4.14.158-129.185.amzn2.x86_64 (ip-172-31-33-239.ec2.internal) 	02/24/2020 	_x86_64_	(2 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.15    0.00    0.11    0.01    0.04   99.70

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
nvme0n1           0.86         2.81         5.87    3312908    6925355

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.25    0.00    0.25    0.00    0.00   99.50

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
nvme0n1           0.00         0.00         0.00          0          0

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.00    0.00    0.00    0.00    0.00  100.00

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
nvme0n1           0.00         0.00         0.00          0          0


iostat – try it with the -xm 2 options for extended statistics, in megabytes, and in two-second intervals.

From Samyak (useful to run while running fio benchmark tests!!!) - captures iostat every 1 sec for 10 mins:

iostat -xdmzt 1 600


iotop’ - a mix between ‘top’ and ‘iostat’ that shows you all of the running processes on the system sorted by their I/O statistics.



Read more: https://coderwall.com/p/utc42q/understanding-iostat