fio硬盤壓力測試


fio測試工具支持同步(pread/pwrite)和異步(libaio)FIO是測試IOPS的非常好的工具,用來對硬件進行壓力測試和驗證,支持13種不同的I/O引擎,包括:sync,mmap, libaio, posixaio, SG v3, splice, null, network, syslet, guasi, solarisaio 等等。  

fio 官網地址:http://freshmeat.net/projects/fio/

安裝

yum -y install libaio libaio-devel 
wget http://brick.kernel.dk/snaps/fio-2.1.7.tar.bz2 

tar xf fio-2.1.7.tar.bz2
cd fio-2.1.7/ 
./configure  
make -j10
make install 

二,測試案例介紹: 
##############################  同步i/o   ##################################################################3 
#同步i/o、順序讀: 
fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=read -ioengine=psync -bs=16k -size=50G -numjobs=30 -runtime=1000 -group_reporting -name=read-psync >read-psync.txt 
#同步i/o、順序寫: 
fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=write -ioengine=psync -bs=16k -size=50G -numjobs=30 -runtime=1000 -group_reporting -name=write-psync >write-psync.txt 
#同步i/o、順序混合讀寫: 
fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=readwrite -rwmixread=50 -ioengine=psync -bs=16k -size=50G -numjobs=30 -runtime=1000 -group_reporting -name=rw-readwrite rw-readwrite-psync.txt
#同步i/o、隨機讀:  
fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=randread -ioengine=psync -bs=16k -size=50G -numjobs=30 -runtime=1000 -group_reporting -name=randread-psync >randread-psync.txt 
#同步i/o、隨機寫:  
fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=randwrite -ioengine=psync -bs=16k -size=50G -numjobs=30 -runtime=1000 -group_reporting -name=randwrite-psync >randwrite-psync.txt 
#同步i/o、隨機混合讀寫:  
fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=randrw -rwmixread=50 -ioengine=psync -bs=16k -size=50G -numjobs=30 -runtime=100 -group_reporting -ioscheduler=noop -name=randrw-psync >randrw-psync.txt  
 
##############################  異步 i/o   ##################################################################3 
 #異步 i/o、順序讀:  
fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=read -ioengine=libaio -bs=16k -size=50G -numjobs=30 -runtime=1000 -group_reporting -name=read-libaio >read-libaio.txt 
#異步 i/o、順序寫: 
fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=write -ioengine=libaio -bs=16k -size=50G -numjobs=30 -runtime=1000 -group_reporting -name=write-libaio >write-libaio.txt 
#異步 i/o、順序混合讀寫: 
fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=readwrite -rwmixread=50 -ioengine=libaio -bs=16k -size=50G -numjobs=30 -runtime=1000 -group_reporting -name=rw-readwrite-libaio >rw-readwrite-psync.txt 
#異步 i/o、隨機讀:  
fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=randread -ioengine=libaio -bs=16k -size=50G -numjobs=30 -runtime=1000 -group_reporting -name=randread-libaio >randread-libaio.txt 
#異步 i/o、隨機寫:  
fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=randwrite -ioengine=libaio -bs=16k -size=50G -numjobs=30 -runtime=1000 -group_reporting -name=randwrite-libaio >randwrite-libaio.txt 
#異步 i/o、隨機混合讀寫:  
fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=randrw -rwmixread=50 -ioengine=libaio -bs=16k -size=50G -numjobs=30 -runtime=100 -group_reporting -ioscheduler=noop -name=randrw-libaio >randrw-libaio.txt  
說明:  
filename=/dev/rbd2 測試文件名稱,需要測試的盤的某目錄。  
direct=1 測試過程繞過機器自帶的buffer。使測試結果更真實。  
read 順序讀 
write 順序寫 
randwrite 隨機寫 
randread 隨機讀 
rw,readwrite 順序混合讀寫 
randrw 隨機混合讀寫 
bs=16k 單次io的塊文件大小為16k  
bsrange=512-2048 同上,提定數據塊的大小范圍  
size=5g 本次的測試文件大小為5g,以每次4k的io進行測試。  
numjobs=30 本次的測試線程為30.  
runtime=1000 測試時間為1000秒,如果不寫則一直將5g文件分4k每次寫完為止。  
ioengine=psync io引擎使用pync方式  
rwmixread=30  在混合讀寫的模式下,讀占30% ,默認%50,兩個參數同時使用,后者覆蓋第一 
rwmixwrite=30 在混合讀寫的模式下,寫占30% ,默認%50 
group_reporting 關於顯示結果的,匯總每個進程的信息。  
lockmem=1g 只使用1g內存進行測試。  
zero_buffers 用0初始化系統buffer。  
nrfiles=8 每個進程生成文件的數量。  
ioscheduler 嘗試切換設備托管文件指定的I / O調度器。 
psync  同步i/o測試 
libaio  異步i/o測試 
libaio的讀寫過程簡單說來就是你發出一個讀寫請求,然后你可以開始做其他事情,當讀寫過程結束時libaio會通知你你的這次請求已經完成 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM