fio使用以及结果观测

  • Post author:
  • Post category:其他


先看一个例子

fio -filename=/dev/nvme0n1 -direct=1 -iodepth  32 -iodepth_batch 1 -iodepth_batch_complete 16 -rw=randread -ioengine=libaio -bs=16k -size=400G -numjobs=1 -runtime=600 -group_reporting -time_based -ramp_time=60 -name=nvme0 >> nvme0-4k-randread.out


1.一些重要参数解释:

  • rw:模拟当前的读写模式,模式有randread,randwrite,randrw(可以指定rwmixread或者rwmixwrite来指定比例,默认50),read,write,rw;

  • thread:fio默认会使用fork()创建job,如果这个选项设置的话,fio将使用pthread_create来创建线程;

  • ioengine:说明job处理io请求的调度方式,一般测试使用libaio(Linux native asynchronous

    I/O);也可以psync;

  • bs:一次io的实际块大小;

  • size:每个job的测试大小,到这里才会结束io请求测试;

  • numjobs:同时并行运行的工作jobs数,相当于一个job克隆,具有相同workload(负载);

  • runtime:运行的时间(s);

    如果不设置time_based,runtime设置的就算很大,那么io大小到size后就会立即停止,而不是到runtime设置的时间;


2.fio结果解读

testfio: (g=0): rw=randrw, bs=(R) 16.0KiB-16.0KiB, (W) 16.0KiB-16.0KiB, (T) 16.0KiB-16.0KiB, ioengine=libaio, iodepth=32
...
fio-3.7
Starting 10 threads
Jobs: 8 (f=8): [m(4),_(1),m(3),_(1),m(1)][91.9%][r=677MiB/s,w=291MiB/s][r=43.4k,w=18.6k IOPS][eta 00m:03s]
testfio: (groupid=0, jobs=10): err= 0: pid=3335: Thu Sep 24 04:25:36 2020
   read: IOPS=26.6k, BW=416MiB/s (436MB/s)(13.0GiB/34469msec)
    slat (usec): min=2, max=375533, avg=40.79, stdev=1058.36
    clat (usec): min=65, max=455661, avg=8296.62, stdev=12218.78
     lat (usec): min=76, max=455669, avg=8338.53, stdev=12297.28
    clat percentiles (usec):
     |  1.00th=[   955],  5.00th=[  1745], 10.00th=[  2245], 20.00th=[  2868],
     | 30.00th=[  3556], 40.00th=[  4228], 50.00th=[  4948], 60.00th=[  5735],
     | 70.00th=[  7177], 80.00th=[ 10159], 90.00th=[ 17957], 95.00th=[ 26608],
     | 99.00th=[ 51643], 99.50th=[ 63177], 99.90th=[147850], 99.95th=[189793],
     | 99.99th=[287310]
   bw (  KiB/s): min=  768, max=128736, per=9.86%, avg=41984.49, stdev=31169.50, samples=678
   iops        : min=   48, max= 8046, avg=2623.95, stdev=1948.09, samples=678
  write: IOPS=11.4k, BW=178MiB/s (187MB/s)(6149MiB/34469msec)
    slat (usec): min=2, max=397853, avg=44.61, stdev=1202.15
    clat (usec): min=135, max=455595, avg=8322.44, stdev=12370.30
     lat (usec): min=148, max=455605, avg=8368.17, stdev=12458.54
    clat percentiles (usec):
     |  1.00th=[   947],  5.00th=[  1762], 10.00th=[  2245], 20.00th=[  2868],
     | 30.00th=[  3556], 40.00th=[  4228], 50.00th=[  4948], 60.00th=[  5735],
     | 70.00th=[  7177], 80.00th=[ 10290], 90.00th=[ 17957], 95.00th=[ 26870],
     | 99.00th=[ 51643], 99.50th=[ 62653], 99.90th=[162530], 99.95th=[193987],
     | 99.99th=[421528]
   bw (  KiB/s): min=  288, max=53120, per=9.86%, avg=18002.25, stdev=13353.37, samples=678
   iops        : min=   18, max= 3320, avg=1125.06, stdev=834.58, samples=678
  lat (usec)   : 100=0.01%, 250=0.01%, 500=0.06%, 750=0.45%, 1000=0.62%
  lat (msec)   : 2=6.00%, 4=30.00%, 10=42.44%, 20=12.12%, 50=7.23%
  lat (msec)   : 100=0.88%, 250=0.18%, 500=0.02%
  cpu          : usr=1.74%, sys=3.50%, ctx=47684, majf=0, minf=10
  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 rwts: total=917210,393510,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=32

Run status group 0 (all jobs):
   READ: bw=416MiB/s (436MB/s), 416MiB/s-416MiB/s (436MB/s-436MB/s), io=13.0GiB (15.0GB), run=34469-34469msec
  WRITE: bw=178MiB/s (187MB/s), 178MiB/s-178MiB/s (187MB/s-187MB/s), io=6149MiB (6447MB), run=34469-34469msec

Disk stats (read/write):
  vdb: ios=914415/392173, merge=0/0, ticks=5986235/2577115, in_queue=7910956, util=65.39%


IOPS: 每秒的输入输出量(或读写次数),是衡量磁盘性能的主要指标之一;


Bw: 带宽;

slat (usec): min=2, max=397853, avg=44.61, stdev=1202.15
clat (usec): min=135, max=455595, avg=8322.44, stdev=12370.30
lat (usec): min=148, max=455605, avg=8368.17, stdev=12458.54


I/O延迟包括三种:slat,clat,lat:关系是 lat = slat + clat;



slat 表示fio submit某个I/O的延迟;

clat 表示fio complete某个I/O的延迟;

lat 表示从fio将请求提交给内核,再到内核完成这个I/O为止所需要的时间;

  lat (usec)   : 100=0.01%, 250=0.01%, 500=0.06%, 750=0.45%, 1000=0.62%
  lat (msec)   : 2=6.00%, 4=30.00%, 10=42.44%, 20=12.12%, 50=7.23%
  lat (msec)   : 100=0.88%, 250=0.18%, 500=0.02%

usec:微秒;msec:毫秒;1ms=1000us;

这组数据表明lat(latency:延迟 )的分布;有0.01%的request延迟<100us,有0.01%的 100us < request lat < 250us,有0.06%的 250us < request lat < 500us,以此类推;

cpu          : usr=1.74%, sys=3.50%, ctx=47684, majf=0, minf=10

usr:表示用户空间进程;

sys:表示内核空间进程;

因为上下文切换导致的主要和次要页面失败的用户/系统 CPU使用百分比。因为测试被配置的使用直接IO,因此有很少的页面失败:;

 IO depths    : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.1%, 16=0.1%, 32=0.1%, >=64=99.9%

iodepth设置用来控制在任何时间有多少IO分发给系统。这完全是应用方面的,意味着它和设备的IO队列做不同的事情,iodepth设置为1因此IO深度在100%的时间里一直是一个1;

Run status group 0 (all jobs):

  READ: bw=416MiB/s (436MB/s), 416MiB/s-416MiB/s (436MB/s-436MB/s), io=13.0GiB (15.0GB), run=34469-34469msec
  WRITE: bw=178MiB/s (187MB/s), 178MiB/s-178MiB/s (187MB/s-187MB/s), io=6149MiB (6447MB), run=34469-34469msec

bw=这组进程的总带宽,每个线程的带宽(设置了numjobs>1这里会很明显);

io=这组总io大小;

线程的最小和最大时间;

Util: The disk utilizatio,磁盘利用率. A value of 100% means we kept the disk busy constantly, 50% would be a disk idling half of the time;


如果fio的size参数设置了多少,正常情况下跑完之后有一个io参数后面的值就是多少

正常性能测试采集数据及时采集平均值,根据这些值来判断性能



版权声明:本文为shoushou_原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。