fio is a tool that will spawn a number of threads or processes doing a particular type of I/O action as specified by the user. The typical use of fio is to write a job file matching the I/O load one wants to simulate.
相对而言,dd只是测试磁盘的物理性能,并且只是测试的磁盘顺序读写的带宽。但实际上磁盘性能的瓶颈往往是IOPS,这个是dd无法测试出来的。
Fio可以按照使用者的需求启动多个线程模拟各种不同的IO操作,测试出有文件系统的磁盘在实际的随机读写的工作模式下所能承受的实际压力。
下载
fio 下载:
[http://freshmeat.net/projects/fio/]
fio 手册:
[http://linux.die.net/man/1/fio]
fio 文章:
[http://www.linux.com/archive/feature/131063]
make & make install 即可
如果出现下面的错误:
CC gettime.o In file included from fio.h:23, from gettime.c:8: os/os.h:15:20: error: libaio.h: No such file or directory In file included from gettime.c:8: fio.h:119: error: field 'iocb' has incomplete type make: *** [gettime.o] Error 1
安装这两个包:
libaio1 libaio-dev
测试
在source code里面自带有测试的fio脚本,使用fio [filename] 即可进行测试,下面的结果是测试vmware 7.0中,NILFS文件系统随机读的测试结果:
rex@rexvm:~/下载/fio-1.36/examples$ fio aio-read file1: 0: randread, 128K-128K/128K-128K, libaio, 4 file2: 0: randread, 128K-128K/128K-128K, libaio, 32 file3: 0: randread, 128K-128K/128K-128K, libaio, 8 file4: 0: randread, 128K-128K/128K-128K, libaio, 16 Starting 4 processes file1: Laying out IO s 1 s / 512MB file2: Laying out IO s 1 s / 512MB file3: Laying out IO s 1 s / 512MB file4: Laying out IO s 1 s / 512MB Jobs: 1 1: r___ 100.0% done 86426K/0K /s 659/0 iops eta 00m:00s file1: 0, 1: 0: 8637 : 524288KB, 24611KB/s, 192, 21303msec slat usec: 123, 57781, 3508.71, 8292.79 clat usec: 47, 388155, 17137.44, 43573.89 bw KB/s : 10069, 75520, 23.88%, 23504.13, 12992.39 cpu : 0.15%, 20.28%, 672, 0, 156 IO depths : 1=0.1%, 2=0.1%, 4=99.9%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0% submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0% : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0% issued r/: 4096/0, 0/0 lat usec: 50=2.88%, 100=24.56%, 250=1.22%, 500=0.46%, 750=4.10% lat usec: 1000=9.25% lat msec: 2=14.23%, 4=15.43%, 10=1.05%, 20=2.95%, 50=16.33% lat msec: 100=2.95%, 250=3.61%, 500=0.95% file2: 0, 1: 0: 8638 : 524288KB, 26222KB/s, 204, 19994msec slat usec: 123, 81954, 4452.41, 9360.67 clat msec: 7, 710, 148.20, 64.75 bw KB/s : 168, 34048, 27.30%, 26875.55, 5675.16 cpu : 0.10%, 24.71%, 678, 0, 1052 IO depths : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.2%, 16=0.4%, 32=99.2%, >=64=0.0% submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0% : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.1%, 64=0.0%, >=64=0.0% issued r/: 4096/0, 0/0 lat msec: 10=0.10%, 20=0.12%, 50=0.71%, 100=9.42%, 250=83.89% lat msec: 500=5.44%, 750=0.32% file3: 0, 1: 0: 8639 : 524288KB, 26203KB/s, 204, 20009msec slat usec: 124, 158833, 4322.76, 9381.58 clat usec: 47, 457767, 34494.35, 47974.57 bw KB/s : 13810, 41306, 27.00%, 26578.39, 5382.38 cpu : 0.20%, 23.35%, 654, 0, 284 IO depths : 1=0.1%, 2=0.1%, 4=0.1%, 8=99.8%, 16=0.0%, 32=0.0%, >=64=0.0% submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0% : 0=0.0%, 4=100.0%, 8=0.1%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0% issued r/: 4096/0, 0/0 lat usec: 50=0.32%, 100=2.37%, 250=0.20%, 500=0.07%, 750=1.03% lat usec: 1000=2.42% lat msec: 2=4.91%, 4=9.64%, 10=9.94%, 20=5.91%, 50=49.68% lat msec: 100=7.32%, 250=5.08%, 500=1.12% file4: 0, 1: 0: 8640 : 524288KB, 26301KB/s, 205, 19934msec slat usec: 124, 65601, 4483.65, 9360.13 clat msec: 1, 459, 72.36, 51.90 bw KB/s : 1237, 39936, 27.08%, 26655.42, 5750.57 cpu : 0.14%, 24.12%, 668, 0, 540 IO depths : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.2%, 16=99.6%, 32=0.0%, >=64=0.0% submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0% : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.1%, 32=0.0%, 64=0.0%, >=64=0.0% issued r/: 4096/0, 0/0 lat msec: 2=0.02%, 4=0.68%, 10=0.78%, 20=1.17%, 50=27.51% lat msec: 100=56.42%, 250=11.06%, 500=2.34% Run status group 0 all : READ: 2048MB, 98443KB/s, 25201KB/s, 26932KB/s, 19934msec, 21303msec Disk stats /: sdb: 16543/3236, 0/0, 234540/23416, 257840, 37.67%
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25618347/viewspace-713869/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/25618347/viewspace-713869/