FIO磁碟效能測試

2021-07-14 06:28:44 字數 2581 閱讀 3053

一,fio安裝

wget

yum install libaio-devel

tar -zxvf fio-2.0.7.tar.gz

cd fio-2.0.7

make

make install

fio用法

fio分順序讀,隨機讀,順序寫,隨機寫,混合隨機讀寫模式。

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 大大提高應用程式的效能」。

iodepth: 如果ioengine採用非同步方式,該引數表示一批提交保持的io單元數。該引數可參考文章「fio壓測工具和io佇列深度理解和誤區」。

rw: i/o模式,隨機讀寫,順序讀寫等等。

bs: i/o block大小,預設是4k。

size: 指定job處理的檔案的大小。

numjobs: 指定job的轉殖數(執行緒)。

time_based: 如果在runtime指定的時間還沒到時檔案就被讀寫完成,將繼續重複知道runtime時間結束。

runtime: 指定在多少秒後停止程序。如果未指定該引數,fio將執行至指定的檔案讀寫完全完成。

group_reporting: 當同時指定了numjobs了時,輸出結果按組顯示。

二,fio用法:

隨機讀:

fio -filename=/dev/sdb1 -direct=1 -iodepth 1 -thread -rw=randread -ioengine=psync -bs=16k -size=200g -numjobs=10 -runtime=1000 -group_reporting -name=mytest

說明:filename=/dev/sdb1       測試檔名稱,通常選擇需要測試的盤的data目錄。

direct=1                 測試過程繞過機器自帶的buffer。使測試結果更真實。

rw=randwrite             測試隨機寫的i/o

rw=randrw                測試隨機寫和讀的i/o

bs=16k                   單次io的塊檔案大小為16k

bsrange=512-2048         同上,提定資料塊的大小範圍

size=5g    本次的測試檔案大小為5g,以每次4k的io進行測試。

numjobs=30               本次的測試執行緒為30.

runtime=1000             測試時間為1000秒,如果不寫則一直將5g檔案分4k每次寫完為止。

ioengine=psync           io引擎使用pync方式

rwmixwrite=30            在混合讀寫的模式下,寫佔30%

group_reporting          關於顯示結果的,彙總每個程序的資訊。

此外lockmem=1g               只使用1g記憶體進行測試。

zero_buffers             用0初始化系統buffer。

nrfiles=8                每個程序生成檔案的數量。

順序讀:

fio -filename=/dev/sdb1 -direct=1 -iodepth 1 -thread -rw=read -ioengine=psync -bs=16k -size=200g -numjobs=30 -runtime=1000 -group_reporting -name=mytest

隨機寫:

fio -filename=/dev/sdb1 -direct=1 -iodepth 1 -thread -rw=randwrite -ioengine=psync -bs=16k -size=200g -numjobs=30 -runtime=1000 -group_reporting -name=mytest

順序寫:

fio -filename=/dev/sdb1 -direct=1 -iodepth 1 -thread -rw=write -ioengine=psync -bs=16k -size=200g -numjobs=30 -runtime=1000 -group_reporting -name=mytest

混合隨機讀寫:

fio -filename=/dev/sdb1 -direct=1 -iodepth 1 -thread -rw=randrw -rwmixread=70 -ioengine=psync -bs=16k -size=200g -numjobs=30 -runtime=100 -group_reporting -name=mytest -ioscheduler=noop

FIO效能測試

fio引數中,ioengine使用libaio,併發jobs數固定為1,通過iodepth來控制壓力。分別測試隨機讀 隨機寫,作為讀寫的效能基準。不測試順序讀寫,不測試混合讀寫。1 測試iops峰值 iodepth 128,塊大小4k。隨機讀 fio direct 1 iodepth 128 rw ...

硬碟效能測試工具fio

fio是測試磁碟效能的乙個非常好的工具,用來對硬體進行壓力測試和驗證。建議使用libaio的i o引擎進行測試,請使用者自行安裝fio和libaio。不同場景的測試公式基本一致,只有3個引數 讀寫模式,iodepth,blocksize 的區別。下面舉例說明使用block size為4k,iodep...

使用FIO工具測試塊儲存效能

linux例項和windows例項都推薦使用fio工具測試塊儲存效能。說明 您也可以使用其他工具測試塊儲存效能,但不同工具測試出來的硬碟基準效能會有差異,如dd sysbench iometer等工具可能會受到測試引數配置和檔案系統影響,難以反映真實的磁碟效能。本文以linux例項和fio為例,說明...