FIO 测试工具使用

xiaoxiao2021-02-28  119

0、直接通过命令执行: $sudo fio -filename=/dev/块设备文件 -direct=1 -rw=randread -bs=4K -size=1G -numjobs=32 -iodepth=32 -runtime=30 -ioengine=libaio -group_reporting -name=zhangyitest

zhangyitest: (g=0): rw=randread, bs=4K-4K/4K-4K/4K-4K, ioengine=libaio, iodepth=32 … fio-2.2.8 Starting 32 processes Jobs: 32 (f=32): [r(32)] [100.0% done] [162.7MB/0KB/0KB /s] [41.7K/0/0 iops] [eta 00m:00s] zhangyitest: (groupid=0, jobs=32): err= 0: pid=44868: Fri May 5 10:46:48 2017 read : io=4821.4MB, bw=164541KB/s, iops=41135, runt= 30005msec slat (usec): min=2, max=10134, avg=776.05, stdev=699.14 clat (msec): min=2, max=49, avg=24.11, stdev= 4.44 lat (msec): min=3, max=50, avg=24.88, stdev= 4.52 clat percentiles (usec): | 1.00th=[14656], 5.00th=[17280], 10.00th=[18560], 20.00th=[20352], | 30.00th=[21632], 40.00th=[22912], 50.00th=[23936], 60.00th=[24960], | 70.00th=[26240], 80.00th=[27776], 90.00th=[29824], 95.00th=[31872], | 99.00th=[35584], 99.50th=[36608], 99.90th=[39680], 99.95th=[41216], | 99.99th=[43776] bw (KB /s): min= 4071, max= 6256, per=3.12%, avg=5140.65, stdev=360.76 lat (msec) : 4=0.01%, 10=0.03%, 20=17.64%, 50=82.33% cpu : usr=0.24%, sys=1.75%, ctx=1115728, majf=0, minf=2173 IO depths : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.1%, 16=0.1%, 32=99.9%, >=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% complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.1%, 64=0.0%, >=64=0.0% issued : total=r=1234265/w=0/d=0, short=r=0/w=0/d=0, drop=r=0/w=0/d=0 latency : target=0, window=0, percentile=100.00%, depth=32

Run status group 0 (all jobs): READ: io=4821.4MB, aggrb=164541KB/s, minb=164541KB/s, maxb=164541KB/s, mint=30005msec, maxt=30005msec

Disk stats (read/write): 块设备文件: ios=1227742/0, merge=0/0, ticks=3731332/0, in_queue=3747746, util=99.91%

/dev/块设备文件 即是需要测试的块设备文件。

2、也可以通过配置文件的方式进行FIO测试。如上面例子,我可以将参数信息放在配置文件中。配置文件主要分为两部分,一部分是全局的global设置,已不是私有的设置,意思就是不同的测试项的设置。比如在我这里的。 $cat fio_conf [global] //全局设置项 ioengine=libaio direct=1 rw=write bs=4k [zhangyitest] //第一个测试项要测试30秒中,切两个job跑 runtime=30 numjobs=2 iodepth=32 filename=/dev/块设备名 [yangtaotest] //第二个测试项要测试10秒中,且一个job跑 runtime=10 numjobs=1 iodepth=32 filename=/dev/块设备名

3、运行fio的话则: $sudo fio fio_conf zhangyitest: (g=0): rw=write, bs=4K-4K/4K-4K/4K-4K, ioengine=libaio, iodepth=32 … yangtaotest: (g=0): rw=write, bs=4K-4K/4K-4K/4K-4K, ioengine=libaio, iodepth=32 fio-2.2.8 Starting 3 processes Jobs: 2 (f=2): [W(2),_(1)] [75.6% done] [0KB/47568KB/0KB /s] [0/11.9K/0 iops] [eta 00m:10s] zhangyitest: (groupid=0, jobs=1): err= 0: pid=68431: Fri May 5 11:24:55 2017 write: io=618808KB, bw=20623KB/s, iops=5155, runt= 30005msec slat (usec): min=3, max=40, avg= 5.28, stdev= 1.33 clat (usec): min=487, max=304397, avg=6200.59, stdev=5005.77 lat (usec): min=492, max=304403, avg=6205.91, stdev=5005.90 clat percentiles (usec): | 1.00th=[ 1656], 5.00th=[ 3920], 10.00th=[ 4704], 20.00th=[ 5024], | 30.00th=[ 5216], 40.00th=[ 5344], 50.00th=[ 5472], 60.00th=[ 5664], | 70.00th=[ 5792], 80.00th=[ 6112], 90.00th=[10048], 95.00th=[11456], | 99.00th=[17280], 99.50th=[18048], 99.90th=[20352], 99.95th=[22144], | 99.99th=[301056] bw (KB /s): min= 7176, max=26187, per=42.99%, avg=20598.83, stdev=5637.81 lat (usec) : 500=0.01%, 750=0.09%, 1000=0.22% lat (msec) : 2=1.08%, 4=3.84%, 10=84.62%, 20=10.02%, 50=0.10% lat (msec) : 500=0.02% cpu : usr=0.46%, sys=3.95%, ctx=129985, majf=0, minf=33 IO depths : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.1%, 16=0.1%, 32=100.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% complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.1%, 64=0.0%, >=64=0.0% issued : total=r=0/w=154702/d=0, short=r=0/w=0/d=0, drop=r=0/w=0/d=0 latency : target=0, window=0, percentile=100.00%, depth=32 zhangyitest: (groupid=0, jobs=1): err= 0: pid=68432: Fri May 5 11:24:55 2017 write: io=629944KB, bw=20994KB/s, iops=5248, runt= 30006msec slat (usec): min=3, max=44, avg= 5.31, stdev= 1.40 clat (usec): min=481, max=34383, avg=6090.96, stdev=2561.30 lat (usec): min=489, max=34393, avg=6096.31, stdev=2561.48 clat percentiles (usec): | 1.00th=[ 1624], 5.00th=[ 3888], 10.00th=[ 4640], 20.00th=[ 5024], | 30.00th=[ 5216], 40.00th=[ 5344], 50.00th=[ 5536], 60.00th=[ 5664], | 70.00th=[ 5792], 80.00th=[ 6048], 90.00th=[ 9664], 95.00th=[11328], | 99.00th=[17024], 99.50th=[17792], 99.90th=[19584], 99.95th=[20608], | 99.99th=[33024] bw (KB /s): min= 7168, max=26176, per=43.77%, avg=20971.66, stdev=5249.62 lat (usec) : 500=0.01%, 750=0.06%, 1000=0.20% lat (msec) : 2=1.18%, 4=3.98%, 10=85.20%, 20=9.31%, 50=0.07% cpu : usr=0.52%, sys=4.02%, ctx=130042, majf=0, minf=33 IO depths : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.1%, 16=0.1%, 32=100.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% complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.1%, 64=0.0%, >=64=0.0% issued : total=r=0/w=157486/d=0, short=r=0/w=0/d=0, drop=r=0/w=0/d=0 latency : target=0, window=0, percentile=100.00%, depth=32 yangtaotest: (groupid=0, jobs=1): err= 0: pid=68433: Fri May 5 11:24:55 2017 write: io=189000KB, bw=18891KB/s, iops=4722, runt= 10005msec slat (usec): min=3, max=34, avg= 7.50, stdev= 1.69 clat (usec): min=555, max=35722, avg=6767.11, stdev=3650.57 lat (usec): min=563, max=35729, avg=6774.65, stdev=3650.69 clat percentiles (usec): | 1.00th=[ 1656], 5.00th=[ 4128], 10.00th=[ 4896], 20.00th=[ 5216], | 30.00th=[ 5408], 40.00th=[ 5536], 50.00th=[ 5664], 60.00th=[ 5792], | 70.00th=[ 5920], 80.00th=[ 6176], 90.00th=[14272], 95.00th=[16320], | 99.00th=[18304], 99.50th=[19072], 99.90th=[22656], 99.95th=[31360], | 99.99th=[34560] bw (KB /s): min= 7176, max=24336, per=39.00%, avg=18687.00, stdev=6342.51 lat (usec) : 750=0.03%, 1000=0.13% lat (msec) : 2=1.26%, 4=3.27%, 10=82.45%, 20=12.59%, 50=0.27% cpu : usr=0.36%, sys=4.69%, ctx=37944, majf=0, minf=29 IO depths : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.1%, 16=0.1%, 32=99.9%, >=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% complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.1%, 64=0.0%, >=64=0.0% issued : total=r=0/w=47250/d=0, short=r=0/w=0/d=0, drop=r=0/w=0/d=0 latency : target=0, window=0, percentile=100.00%, depth=32

Run status group 0 (all jobs): WRITE: io=1404.6MB, aggrb=47915KB/s, minb=18890KB/s, maxb=20993KB/s, mint=10005msec, maxt=30006msec

Disk stats (read/write): 块设备名: ios=0/357704, merge=0/0, ticks=0/2229352, in_queue=2229805, util=99.70% 这里输出会把所有的job(这里是3个job)都输出出来。

参数含义

filename: 指定文件(设备)的名称。可以通过冒号分割同时指定多个文件,如filename=/dev/sda:/dev/sdb。 directory: 设置filename的路径前缀。在后面的基准测试中,采用这种方式来指定设备。 name: 指定job的名字,在命令行中表示新启动一个job。 direct: bool类型,如果设置成true (1),表示不使用io buffer。 ioengine: I/O引擎,现在fio支持19种ioengine。默认值是sync同步阻塞I/O,libaio是Linux的native异步I/O。关于同步异步,阻塞和非阻塞模型可以参考文章“使用异步 I/O 大大提高应用程序的性能”。 http://www.ibm.com/developerworks/cn/linux/l-async/ iodepth: 如果ioengine采用异步方式,该参数表示一批提交保持的io单元数。该参数可参考文章“Fio压测工具和io队列深度理解和误区”。 http://blog.yufeng.info/archives/2104 rw: I/O模式,随机读写,顺序读写等等。 bs: I/O block大小,默认是4k。 size: 指定job处理的文件的大小。 numjobs: 指定job的克隆数(线程)。 time_based: 如果在runtime指定的时间还没到时文件就被读写完成,将继续重复知道runtime时间结束。 runtime: 指定在多少秒后停止进程。如果未指定该参数,fio将执行至指定的文件读写完全完成。 group_reporting: 当同时指定了numjobs了时,输出结果按组显示。

转载请注明原文地址: https://www.6miu.com/read-19985.html

最新回复(0)