本頁詳細說明如何驗證磁碟區效能。
使用 Fio 評估磁碟區效能
使用 I/O 產生器工具 Fio 測量基準效能。
使用 Fio
Fio 會套用您透過指令列介面或設定檔指定的負載。執行期間,Fio 會顯示進度指標,以及目前的總處理量和每秒輸入/輸出作業數 (IOPS)。結束後,系統會顯示詳細摘要。
Fio 結果範例
以下範例顯示單一執行緒的 4K 隨機寫入工作執行 60 秒,這是測量基準延遲時間的實用方法。在下列指令中,--directory 參數會指向含有已掛接 NetApp Volumes 共用資料夾的資料夾:
  $ FIO_COMMON_ARGS=--size=10g --fallocate=none --direct=1 --runtime=60 --time_based --ramp_time=5
  $ fio $FIO_COMMON_ARGS --directory=/netapp --ioengine=libaio --rw=randwrite --bs=4k --iodepth=1 --name=nv
  cvs: (g=0): rw=randwrite, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=libaio, iodepth=1
  fio-3.28
  Starting 1 process
  cvs: Laying out IO file (1 file / 10240MiB)
  Jobs: 1 (f=1): [w(1)][100.0%][w=7856KiB/s][w=1964 IOPS][eta 00m:00s]
  cvs: (groupid=0, jobs=1): err= 0: pid=1891: Wed Dec 21 14:56:37 2022
    write: IOPS=1999, BW=7999KiB/s (8191kB/s)(469MiB/60001msec); 0 zone resets
      slat (usec): min=4, max=417, avg=12.06, stdev= 5.71
      clat (usec): min=366, max=27978, avg=483.59, stdev=91.34
      lat (usec): min=382, max=28001, avg=495.96, stdev=91.89
      clat percentiles (usec):
      |  1.00th=[  408],  5.00th=[  429], 10.00th=[  437], 20.00th=[  449],
      | 30.00th=[  461], 40.00th=[  469], 50.00th=[  482], 60.00th=[  490],
      | 70.00th=[  498], 80.00th=[  515], 90.00th=[  529], 95.00th=[  553],
      | 99.00th=[  611], 99.50th=[  652], 99.90th=[  807], 99.95th=[  873],
      | 99.99th=[ 1020]
    bw (  KiB/s): min= 7408, max= 8336, per=100.00%, avg=8002.05, stdev=140.09, samples=120
    iops        : min= 1852, max= 2084, avg=2000.45, stdev=35.06, samples=120
    lat (usec)   : 500=70.67%, 750=29.17%, 1000=0.15%
    lat (msec)   : 2=0.01%, 4=0.01%, 50=0.01%
    cpu          : usr=2.04%, sys=3.25%, ctx=120561, majf=0, minf=58
    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 rwts: total=0,119984,0,0 short=0,0,0,0 dropped=0,0,0,0
      latency   : target=0, window=0, percentile=100.00%, depth=1
  Run status group 0 (all jobs):
    WRITE: bw=7999KiB/s (8191kB/s), 7999KiB/s-7999KiB/s (8191kB/s-8191kB/s), io=469MiB (491MB), run=60001-60001msec
如要瞭解成效結果的詳細資料,請參閱下列各行:
延遲:
lat (usec): min=382, max=28001, avg=495.96, stdev=91.89平均延遲時間為 495.96 微秒 (usec),約為 0.5 毫秒,這是理想的延遲時間。
IOPS:
min= 1852, max= 2084, avg=2000.45, stdev=35.06, samples=120上例顯示平均 IOPS 為 2,000。對於延遲時間為 0.5 毫秒的單一執行緒工作,這個值是預期結果 (
IOPS = 1000 ms/0.5 ms = 2000)。處理量:
bw ( KiB/s): min= 7408, max=8336, per=100.00%, avg=8002.05, stdev=140.09平均總處理量為 8002 KiBps,這是 2,000 IOPS 且區塊大小為 4 KiB (
2000 1/s * 4 KiB = 8,000 KiB/s) 時的預期結果。
測量延遲時間
延遲是評估音量成效的基本指標。這是因為用戶端和伺服器的功能、用戶端和伺服器之間的距離 (你的音量),以及兩者之間的設備都會影響音量。這項指標的主要成分是距離造成的延遲。
您可以對磁碟區的 IP 執行 Ping,取得來回時間,這是延遲時間的粗略估計值。
延遲時間取決於區塊大小,以及您執行的作業是讀取還是寫入。建議您使用下列參數,測量用戶端與磁碟區之間的基準延遲時間:
Linux
fio --directory=/netapp \ --ioengine=libaio \ --rw=randwrite \ --bs=4k --iodepth=1 \ --size=10g \ --fallocate=none \ --direct=1 \ --runtime=60 \ --time_based \ --ramp_time=5 \ --name=latency
Windows
fio --directory=Z\:\ --ioengine=windowsaio --thread --rw=randwrite --bs=4k --iodepth=1 --size=10g --fallocate=none --direct=1 --runtime=60 --time_based --ramp_time=5 --name=latency
請根據工作負載替換參數 rw (讀取/寫入/隨機讀取/隨機寫入) 和 bs (區塊大小)。區塊越大,延遲時間就越長,讀取速度會比寫入速度快。結果會顯示在 lat 列中。
測量 IOPS
IOPS 是延遲和並行作業的直接結果。根據用戶端類型,使用下列其中一個分頁來評估 IOPS:
Linux
fio --directory=/netapp \ --ioengine=libaio \ --rw=randread \ --bs=4k \ --iodepth=32 \ --size=10g \ --fallocate=none \ --direct=1 \ --runtime=60 \ --time_based \ --ramp_time=5 \ --name=iops
Windows
fio --directory=Z\:\ --ioengine=windowsaio --thread --rw=randread --bs=4k --iodepth=32 --size=10g --fallocate=none --direct=1 --runtime=60 --time_based --ramp_time=5 --numjobs=16 --name=iops
請根據工作負載替換參數 rw (讀取/寫入/隨機讀取/隨機寫入)、bs (區塊大小) 和 iodepth (並行)。結果會顯示在 iops 列中。
測量處理量
總處理量是 IOPS 乘以區塊大小。請根據用戶端類型,使用下列其中一個分頁來評估輸送量:
Linux
fio --directory=/netapp \ --ioengine=libaio \ --rw=read \ --bs=64k \ --iodepth=32 \ --size=10g \ --fallocate=none \ --direct=1 \ --runtime=60 \ --time_based \ --ramp_time=5 \ --numjobs=16 \ --name=throughput
Windows
fio --directory=Z\:\ --ioengine=windowsaio --thread --rw=read --bs=64k --iodepth=32 --size=10g --fallocate=none --direct=1 --runtime=60 --time_based --ramp_time=5 --numjobs=16 --name=throughput
請根據工作負載替換參數 rw (讀取/寫入/隨機讀取/隨機寫入)、bs (區塊大小) 和 iodepth (並行)。只有使用 64k 以上的區塊大小和高並行,才能達到高輸送量。
後續步驟
查看成效基準。