3,760 瀏覽數

Fio – Flexible I/O Tester (Job file)

之前有針對 Fio 做簡單的介紹 http://benjr.tw/34632 ,但他可以像是 Iometer 一樣直接將 # of Outstanding IO 設定成,等比 (Exponential steeping) 1,2,4,8,16.. 或是 等差(Linear Steeping) 1,2,4,6,8.. 的方式進行測試嗎?

答案是可以的,只需要透過 Job file (configuration) 檔案,先編輯好我們要測試的不同參數值.

當設定比較複雜時我們可以透過 Job file 的設定來進行 Fio 的測試,Job file 其實就兩段 [global] : 共用的設定參數 , [job] :特別指定的參數.

如果想要跑不同的 iodepth (類似 Iometer 的 outstanding IO) ,我們就可以自訂 Job ,各別跑不同的 iodepth (1,2,4)

#vi fio01.cfg
[global]
direct=1
ioengine=libaio
filename=/dev/sdb
time_based
rw=read
rwmixread=100
runtime=30s
bs=64k
[1 JOB]
iodepth=1
[2 JOB]
iodepth=2
[4 JOB]
iodepth=4

執行結果如下.

# fio fio01.cfg
1 JOB: (g=0): rw=read, bs=64K-64K/64K-64K/64K-64K, ioengine=libaio, iodepth=1
2 JOB: (g=0): rw=read, bs=64K-64K/64K-64K/64K-64K, ioengine=libaio, iodepth=2
4 JOB: (g=0): rw=read, bs=64K-64K/64K-64K/64K-64K, ioengine=libaio, iodepth=4
fio-2.1.3
Starting 3 processes
Jobs: 3 (f=3): [RRR] [100.0% done] [118.9MB/0KB/0KB /s] [1901/0/0 iops] [eta 00m:00s]
1 JOB: (groupid=0, jobs=1): err= 0: pid=3419: Wed Dec  3 15:46:08 2014
  read : io=1628.8MB, bw=55591KB/s, iops=868, runt= 30002msec
    slat (usec): min=0, max=28216, avg=154.68, stdev=834.64
    clat (usec): min=0, max=23828, avg=624.26, stdev=1062.30
     lat (usec): min=21, max=36187, avg=956.06, stdev=1794.76
    clat percentiles (usec):
     |  1.00th=[   16],  5.00th=[   18], 10.00th=[  294], 20.00th=[  334],
     | 30.00th=[  342], 40.00th=[  358], 50.00th=[  362], 60.00th=[  378],
     | 70.00th=[  402], 80.00th=[  490], 90.00th=[ 1080], 95.00th=[ 1992],
     | 99.00th=[ 4832], 99.50th=[ 7776], 99.90th=[12608], 99.95th=[15808],
     | 99.99th=[19840]
    bw (KB  /s): min=33650, max=71296, per=48.57%, avg=55615.61, stdev=7962.12
    lat (usec) : 2=0.15%, 10=0.02%, 20=5.44%, 50=1.02%, 100=0.54%
    lat (usec) : 250=0.53%, 500=72.94%, 750=4.40%, 1000=3.73%
    lat (msec) : 2=6.27%, 4=3.25%, 10=1.48%, 20=0.23%, 50=0.01%
  cpu          : usr=0.00%, sys=19.82%, ctx=25172, majf=0, minf=44
  IO depths    : 1=100.0%, 2=0.0%, 4=0.0%, 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%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued    : total=r=26060/w=0/d=0, short=r=0/w=0/d=0
2 JOB: (groupid=0, jobs=1): err= 0: pid=3420: Wed Dec  3 15:46:08 2014
  read : io=860480KB, bw=28668KB/s, iops=447, runt= 30015msec
    slat (usec): min=0, max=61959, avg=433.21, stdev=2490.38
    clat (usec): min=16, max=75008, avg=2662.03, stdev=6225.03
     lat (usec): min=150, max=75091, avg=3404.54, stdev=7024.60
    clat percentiles (usec):
     |  1.00th=[  147],  5.00th=[  161], 10.00th=[  394], 20.00th=[  402],
     | 30.00th=[  414], 40.00th=[  426], 50.00th=[  442], 60.00th=[  572],
     | 70.00th=[  908], 80.00th=[ 1736], 90.00th=[ 8640], 95.00th=[14528],
     | 99.00th=[33024], 99.50th=[40704], 99.90th=[53504], 99.95th=[61184],
     | 99.99th=[72192]
    bw (KB  /s): min=17488, max=51888, per=25.06%, avg=28691.66, stdev=6273.73
    lat (usec) : 20=0.05%, 100=0.02%, 250=7.49%, 500=50.37%, 750=8.41%
    lat (usec) : 1000=5.21%
    lat (msec) : 2=10.33%, 4=4.21%, 10=5.39%, 20=5.62%, 50=2.75%
    lat (msec) : 100=0.15%
  cpu          : usr=0.00%, sys=27.33%, ctx=11227, majf=0, minf=59
  IO depths    : 1=0.1%, 2=100.0%, 4=0.0%, 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%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued    : total=r=13445/w=0/d=0, short=r=0/w=0/d=0
4 JOB: (groupid=0, jobs=1): err= 0: pid=3421: Wed Dec  3 15:46:08 2014
  read : io=908608KB, bw=30291KB/s, iops=473, runt= 29996msec
    slat (usec): min=0, max=72132, avg=578.18, stdev=2907.86
    clat (usec): min=16, max=81425, avg=6669.00, stdev=9498.97
     lat (usec): min=491, max=82132, avg=7583.33, stdev=10035.45
    clat percentiles (usec):
     |  1.00th=[  442],  5.00th=[  940], 10.00th=[ 1020], 20.00th=[ 1208],
     | 30.00th=[ 1256], 40.00th=[ 1384], 50.00th=[ 1816], 60.00th=[ 2640],
     | 70.00th=[ 7456], 80.00th=[12864], 90.00th=[17536], 95.00th=[25984],
     | 99.00th=[44800], 99.50th=[53504], 99.90th=[71168], 99.95th=[81408],
     | 99.99th=[81408]
    bw (KB  /s): min=19428, max=71750, per=26.51%, avg=30351.73, stdev=7895.70
    lat (usec) : 20=0.04%, 50=0.01%, 100=0.01%, 250=0.08%, 500=1.07%
    lat (usec) : 750=1.68%, 1000=6.06%
    lat (msec) : 2=44.72%, 4=11.21%, 10=10.64%, 20=16.44%, 50=7.43%
    lat (msec) : 100=0.62%
  cpu          : usr=0.00%, sys=28.00%, ctx=10692, majf=0, minf=91
  IO depths    : 1=0.1%, 2=0.1%, 4=100.0%, 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%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued    : total=r=14197/w=0/d=0, short=r=0/w=0/d=0

Run status group 0 (all jobs):
   READ: io=3356.4MB, aggrb=114507KB/s, minb=28668KB/s, maxb=55590KB/s, mint=29996msec, maxt=30015msec

Disk stats (read/write):
  sdb: ios=53327/0, merge=0/0, ticks=29460/0, in_queue=29444, util=72.64%

跑的結果比較重要的點如下:

這是 [1 JOB] iodepth=1 所得到的結果,io=1628.8MB, bw=55591KB/s

1 JOB: (groupid=0, jobs=1): err= 0: pid=3419: Wed Dec  3 15:46:08 2014
  read : io=1628.8MB, bw=55591KB/s, iops=868, runt= 30002msec

這是 [2 JOB] iodepth=2 所得到的結果,io=860480KB, bw=28668KB/s

2 JOB: (groupid=0, jobs=1): err= 0: pid=3420: Wed Dec  3 15:46:08 2014
  read : io=860480KB, bw=28668KB/s, iops=447, runt= 30015msec

這是 [4 JOB] iodepth=4 所得到的結果,read : io=908608KB, bw=30291KB/s

4 JOB: (groupid=0, jobs=1): err= 0: pid=3421: Wed Dec  3 15:46:08 2014
  read : io=908608KB, bw=30291KB/s, iops=473, runt= 29996msec

這是 3 個 JOB 統計的結果 [1 JOB] iodepth=1, [2 JOB] iodepth=2, [4 JOB] iodepth=4 所得到的結果,io=3356.4MB, aggrb=114507KB/s

Run status group 0 (all jobs):
   READ: io=3356.4MB, aggrb=114507KB/s, minb=28668KB/s, maxb=55590KB/s, mint=29996msec, maxt=30015msec

不過這樣的跑法會有一個問題,不同的 JOB 是同時跑的,我們會希望第一個 JOB 跑完再跑下一個,這時可以使用另外一個參數 wait_for_previous 就可以解決這問題.
wait_for_previous : Wait for preceding jobs in the job file to exit, before starting this one. Can be used to insert serialization points in the job file. A stone wall also implies starting a new reporting group.

note:
在執行時會看到 bs=64K-64K/64K-64K/64K-64K 後面三個參數是代表什麼意思呢!! 這是跟 bssplit 參數有關.
bssplit=str
This option allows even finer grained control of the block sizes issued, not just even splits between them. With this option, you can weight various block sizes for exact control of the issued IO for a job that has mixed block sizes. The format of the option is bssplit=blocksize/percentage, optionally adding as many definitions as needed separated by a colon. Example: bssplit=4k/10:64k/50:32k/40 would issue 50% 64k blocks, 10% 4k blocks and 40% 32k blocks

2 個網友的想法 “Fio – Flexible I/O Tester (Job file)

  1. 自動參照通知: 張小捲的私生活 | Fio – Flexible I/O Tester。linux 系統中測試硬碟IO效能

  2. 自動參照通知: Fio – Flexible I/O Tester | Benjr.tw

發表迴響