代码改变世界

Linux的IO性能监控

2015-02-25 14:39  AlfredZhao  阅读(557)  评论(0编辑  收藏  举报

一般使用iostat命令监控I/O性能
1.iostat命令可用参数列表:

OPTIONS
       -c     Display the CPU utilization report.

       -d     Display the device utilization report.

       -h     Make the NFS report displayed by option -n easier to read by a human.

       -k     Display statistics in kilobytes per second instead of blocks per second.  Data displayed are valid only with kernels  2.4  and
              later.

       -m     Display statistics in megabytes per second instead of blocks or kilobytes per second.  Data displayed are valid only with ker-
              nels 2.4 and later.

       -N     Display the registered device mapper names for any device mapper devices.  Useful for viewing LVM2 statistics.

       -n     Display the network filesystem (NFS) report. This option works only with kernel 2.6.17 and later.

       -p [ { device [,...] | ALL } ]
              The -p option displays statistics for block devices and all their partitions that are used by the system.  If a device name is
              entered on the command line, then statistics for it and all its partitions are displayed. Last, the ALL keyword indicates that
              statistics have to be displayed for all the block devices and partitions defined by the  system,  including  those  that  have
              never been used.  Note that this option works only with post 2.5 kernels.

       -t     Print  the time for each report displayed. The timestamp format may depend on the value of the S_TIME_FORMAT environment vari-
              able (see below).

       -V     Print version number then exit.

       -x     Display extended statistics.  This option works with post 2.5 kernels since it needs /proc/diskstats file or a  mounted  sysfs
              to  get  the  statistics. This option may also work with older kernels (e.g. 2.4) only if extended statistics are available in
              /proc/partitions (the kernel needs to be patched for that).

       -z     Tell iostat to omit output for any devices for which there was no activity during the sample period.

2.iostat 常用参数举例:
iostat -d -x -k 1 10

$ iostat -d -x -k 1 10
Linux 2.6.32-358.el6.x86_64 (vnode1)    2015年02月25日  _x86_64_        (64 CPU)

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await  svctm  %util
sda               7.23  2923.45  111.97  158.24  4305.81 12331.61   123.14     0.42    1.53   1.55  41.99

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await  svctm  %util
sda               0.00     0.00 1313.00    0.00 38884.00     0.00    59.23    13.14   10.14   0.76 100.10

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await  svctm  %util
sda               0.00 19604.00  587.00  361.00  8380.00 55624.00   135.03    80.47   64.34   1.05 100.00

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await  svctm  %util
sda               1.00 11641.00   93.00 1079.00  4436.00 67312.00   122.44   143.71  119.34   0.85 100.00

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await  svctm  %util
sda               0.00 12925.00   91.00 1036.00  6612.00 54072.00   107.69   142.63  133.53   0.89 100.00

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await  svctm  %util
sda               0.00 15597.00   66.00 1101.00  3284.00 69080.00   124.02   142.49  124.61   0.86 100.00

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await  svctm  %util
sda               4.00  6834.00  326.00  766.00 10532.00 37696.00    88.33    75.73   80.81   0.92 100.00

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await  svctm  %util
sda               0.00  7322.00  417.00  331.00  6796.00 22568.00    78.51    65.42   68.01   1.34 100.00

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await  svctm  %util
sda               0.00 12862.00   80.00 1464.00  1424.00 63416.00    83.99   121.29   87.37   0.65 100.00

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await  svctm  %util
sda               0.00     0.00  857.00   10.00 12512.00  1972.00    33.41    11.65   14.53   1.15 100.00

iostat -d -k 1 10

$ iostat -d -k 1 10
Linux 2.6.32-358.el6.x86_64 (vnode1)    2015年02月25日  _x86_64_        (64 CPU)

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sda             270.40      4306.84     12331.65 23370851441 66917123180

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sda             812.00     35820.00        56.00      35820         56

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sda            1175.00     24940.00       508.00      24940        508

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sda             910.00     10056.00     12224.00      10056      12224

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sda             733.00      2672.00     20064.00       2672      20064

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sda             836.00       712.00     10456.00        712      10456

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sda             995.00       604.00     13052.00        604      13052

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sda             966.00       104.00     14264.00        104      14264

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sda             811.00       268.00     19728.00        268      19728

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sda            1056.00       124.00     16788.00        124      16788

更多关于iostat命令的说明可参见转载文章:http://www.cnblogs.com/jyzhao/articles/4299419.html