Linux I/O Performance Messungen mit iostat

Aus Thomas-Krenn-Wiki
(Weitergeleitet von Iostat)
Wechseln zu: Navigation, Suche

Das Monitoring-Tool iostat liefert Input/Output Statistiken für Devices, Partitionen und Netzwerk-Dateisysteme (NFS). Daneben gibt es auch CPU Statistiken aus. Iostat ist Teil des sysstat Pakets.

Grundlagen von iostat

iostat gibt eine Reihe von Werten aus und wird typischerweise mit zwei numerischen Parametern aufgerufen:

  • Beispiel: iostat 1 5
    • 1 -> die Werte werden jede Sekunde erneut gemessen und ausgegeben
    • 5 -> die Werte werden 5x ausgegeben, danach wird das Programm beendet

Die erste Ausgabezeile enthält dabei die Durchschnittswerte seit dem letzten Reboot. Alle weiteren Ausgabezeilen stellen die jeweils aktuellen Werte dar. iostat benötigt keine speziellen Benutzerrechte, man kann es also als normaler Benutzer ausführen.

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
[...]

Optionen von iostat

iostat

Ohne spezielle Parameter sieht die Standardausgabe so aus:

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

Die Option -x liefert die erweiterte (extended) Statistik:

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

Die Option -d zeigt nur Device-Statistiken (keine CPU-Statistiken):

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

Die Option -c zeigt nur CPU-Statistiken (keine Device-Statistiken):

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:~$ 

Bedeutung der einzelnen Werte

(Quelle 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.
  • <b>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.

Weitere Informationen


Foto Werner Fischer.jpg

Autor: Werner Fischer

Werner Fischer, tätig im Bereich Communications / Knowledge Transfer bei Thomas-Krenn, hat sein Studium zu Computer- und Mediensicherheit an der FH Hagenberg abgeschlossen. Er ist regelmäßig Autor in Fachzeitschriften und Speaker bei Konferenzen wie LinuxCon, OSDC, OSMC, LinuxTag u.v.m. Seine Freizeit gestaltet er sehr abwechslungsreich. In einem Moment absolviert er seinen Abschluss im Klavierspielen, im anderen läuft er beim Linzmarathon in der Staffel mit oder interessiert sich für OpenStreetMap.


Das könnte Sie auch interessieren

Backup unter Linux mit rdiff-backup
Linux I/O Performance Messungen mit iotop
Linux Netzwerk Analyse mit mtr