Home > Linux, 工具介绍, 调优 > IO模式调查利器blkiomon介绍

IO模式调查利器blkiomon介绍

原创文章,转载请注明: 转载自系统技术非业余研究

本文链接地址: IO模式调查利器blkiomon介绍

blkiomon 是blktrace工具包带的一个方便用户了解IO情况的工具, 由于blktrace太专业,需要了解的IO协议栈的东西太多,blkiomon给大多数的用户提供了一种易于使用的方式.
blktrace的使用参考这里: http://blog.yufeng.info/archives/tag/blktrace
他可以告诉你IO的大小,完成花费时间,吞吐量, 还可以统计出这次关键参数的分布.
具体见man blkiomon

blkiomon is a block device I/O monitor. It periodically generates per-device request size and request latency statistics from blktrace data. It
provides histograms as well as data that can be used to calculate min, max, average and variance. For this purpose, it consumes D and C traces
read from stdin.

我们来演示下:

$ sudo yum -y install blktrace
$ pwd
/u01
$ df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sdb1            5568626692  14335120 5266858860   1% /u01
...
$ sudo blktrace /dev/sdb1 -a issue -a complete -w 3600 -o - | blkiomon -I 10 -h -

#在另外一个终端运行:
$ sudo dd if=/dev/zero of=test.dat bs=4096 count=111112
111112+0 records in
111112+0 records out
455114752 bytes (455 MB) copied, 0.709956 seconds, 641 MB/s

#我们可以看到blkiomon说:
time: Wed Nov  9 21:45:53 2011
device: 8,17
sizes read (bytes): num 0, min -1, max 0, sum 0, squ 0, avg nan, var nan
sizes write (bytes): num 1507, min 4096, max 327680, sum 455626752, squ 146959973220352, avg 302340.2, var 6108605540.9
d2c read (usec): num 0, min -1, max 0, sum 0, squ 0, avg nan, var nan
d2c write (usec): num 1507, min 180, max 263554, sum 139205481, squ 17063321146863, avg 92372.6, var 2790014230.4
throughput read (bytes/msec): num 0, min -1, max 0, sum 0, squ 0, avg nan, var nan
throughput write (bytes/msec): num 1507, min 15, max 368593, sum 7687253, squ 314837228769, avg 5101.0, var 182896029.6
sizes histogram (bytes):
            0:     0         1024:     0         2048:     0         4096:    80
         8192:     0        16384:     1        32768:     5        65536:     6
       131072:     2       262144:   110       524288:  1303      1048576:     0
      2097152:     0      4194304:     0      8388608:     0    > 8388608:     0
d2c histogram (usec):
            0:     0            8:     0           16:     0           32:     0
           64:     0          128:     0          256:     1          512:     1
         1024:     1         2048:     1         4096:     3         8192:     8
        16384:     3        32768:    95        65536:   395       131072:   718
       262144:   280       524288:     1      1048576:     0      2097152:     0
      4194304:     0      8388608:     0     16777216:     0     33554432:     0
    >33554432:     0
bidirectional requests: 0

从输出可以了解的很清楚我们的io模式,也很方便使用.
祝玩得开心!

Post Footer automatically generated by wp-posturl plugin for wordpress.

Categories: Linux, 工具介绍, 调优 Tags: ,