新聞中心
FIO是測(cè)試IOPS的非常好的工具,用來對(duì)磁盤進(jìn)行壓力測(cè)試和驗(yàn)證。磁盤IO是檢查磁盤性能的重要指標(biāo),可以按照負(fù)載情況分成照順序讀寫,隨機(jī)讀寫兩大類。FIO是一個(gè)可以產(chǎn)生很多線程或進(jìn)程并執(zhí)行用戶指定的特定類型I/O操作的工具,F(xiàn)IO的典型用途是編寫和模擬的I/O負(fù)載匹配的作業(yè)文件。也就是說FIO 是一個(gè)多線程io生成工具,可以生成多種IO模式,用來測(cè)試磁盤設(shè)備的性能(也包含文件系統(tǒng):如針對(duì)網(wǎng)絡(luò)文件系統(tǒng) NFS 的IO測(cè)試)。

FIO安裝
wget http://brick.kernel.dk/snaps/fio-2.0.7.tar.gz yum install libaio-devel 安裝依賴。我們一般使用libaio,發(fā)起異步IO請(qǐng)求。 tar -zxvf fio-2.0.7.tar.gz cd fio-2.0.7 make make install
簡單介紹fio的參數(shù)
ioengine: 負(fù)載引擎,我們一般使用libaio,發(fā)起異步IO請(qǐng)求。 bs: IO大小 direct: 直寫,繞過操作系統(tǒng)Cache。因?yàn)槲覀儨y(cè)試的是硬盤,而不是操作系統(tǒng)的Cache,所以設(shè)置為1。 rw: 讀寫模式,有順序?qū)憌rite、順序讀read、隨機(jī)寫randwrite、隨機(jī)讀randread等。 size: 尋址空間,IO會(huì)落在 [0, size)這個(gè)區(qū)間的硬盤空間上。這是一個(gè)可以影響IOPS的參數(shù)。一般設(shè)置為硬盤的大小。 filename: 測(cè)試對(duì)象 iodepth: 隊(duì)列深度,只有使用libaio時(shí)才有意義。這是一個(gè)可以影響IOPS的參數(shù)。 runtime: 測(cè)試時(shí)長
常見測(cè)試方法
順序讀
fio -filename=/dev/sda -direct=1 -iodepth 1 -thread -rw=read -ioengine=psync -bs=16k -size=200G -numjobs=30 -runtime=1000 -group_reporting -name=mytest
順序?qū)?/h4>fio -filename=/dev/sda -direct=1 -iodepth 1 -thread -rw=write -ioengine=psync -bs=16k -size=200G -numjobs=30 -runtime=1000 -group_reporting -name=mytest
隨機(jī)讀
fio -filename=/dev/sda -direct=1 -iodepth 1 -thread -rw=randread -ioengine=psync -bs=16k -size=200G -numjobs=30 -runtime=1000 -group_reporting -name=mytest
隨機(jī)寫
fio -filename=/dev/sda -direct=1 -iodepth 1 -thread -rw=randwrite -ioengine=psync -bs=16k -size=200G -numjobs=30 -runtime=1000 -group_reporting -name=mytest
混合隨機(jī)讀寫
fio -filename=/dev/sda -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測(cè)試腳本
#/bin/bash
#author wsm
#date 2019/06/17
#fio順序讀測(cè)試
#-filename 測(cè)試對(duì)象
#-direct=1測(cè)試過程繞過機(jī)器自帶的buffer。使測(cè)試結(jié)果更真實(shí)
#-iodepth 1
#-thread
#-rw=read
#-ioengine=psync io引擎使用pync方式
#-bs=16k單次io的塊文件大小為16k
#-size=100G測(cè)試文件大小
#-numjobs=30測(cè)試線程為30
#-runtime=1000 測(cè)試時(shí)間為1000秒
#-group_reporting 關(guān)于顯示結(jié)果的,匯總每個(gè)進(jìn)程的信息
#-name=mytest
for i in {a..z} a{a..z};do
fio -filename=/dev/sd$i -direct=1 -iodepth 1 -thread -rw=read -ioengine=psync -bs=16k -size=100G -numjobs=30 -runtime=1000 -group_reporting -name=mytest
done
測(cè)試結(jié)果
–型號(hào):XXX; 硬盤:900G/SAS 10K/2.5寸硬盤/RAID18k 隨機(jī)寫:iops=7988k 隨機(jī)讀:iops=111908k 混合讀寫(讀寫7:3):讀iops=1114 寫iops=4791m 順序?qū)?iops=1701m 順序讀:iops=246 1m 順序讀寫(讀寫7:3):讀iops=134 寫iops=56
網(wǎng)頁名稱:Linux系統(tǒng)中使用FIO對(duì)硬盤進(jìn)行壓力測(cè)試
鏈接URL:http://fisionsoft.com.cn/article/dhippps.html
fio -filename=/dev/sda -direct=1 -iodepth 1 -thread -rw=write -ioengine=psync -bs=16k -size=200G -numjobs=30 -runtime=1000 -group_reporting -name=mytest
fio -filename=/dev/sda -direct=1 -iodepth 1 -thread -rw=randread -ioengine=psync -bs=16k -size=200G -numjobs=30 -runtime=1000 -group_reporting -name=mytest
fio -filename=/dev/sda -direct=1 -iodepth 1 -thread -rw=randwrite -ioengine=psync -bs=16k -size=200G -numjobs=30 -runtime=1000 -group_reporting -name=mytest
fio -filename=/dev/sda -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測(cè)試腳本
#/bin/bash
#author wsm
#date 2019/06/17
#fio順序讀測(cè)試
#-filename 測(cè)試對(duì)象
#-direct=1測(cè)試過程繞過機(jī)器自帶的buffer。使測(cè)試結(jié)果更真實(shí)
#-iodepth 1
#-thread
#-rw=read
#-ioengine=psync io引擎使用pync方式
#-bs=16k單次io的塊文件大小為16k
#-size=100G測(cè)試文件大小
#-numjobs=30測(cè)試線程為30
#-runtime=1000 測(cè)試時(shí)間為1000秒
#-group_reporting 關(guān)于顯示結(jié)果的,匯總每個(gè)進(jìn)程的信息
#-name=mytest
for i in {a..z} a{a..z};do
fio -filename=/dev/sd$i -direct=1 -iodepth 1 -thread -rw=read -ioengine=psync -bs=16k -size=100G -numjobs=30 -runtime=1000 -group_reporting -name=mytest
done
–型號(hào):XXX; 硬盤:900G/SAS 10K/2.5寸硬盤/RAID18k 隨機(jī)寫:iops=7988k 隨機(jī)讀:iops=111908k 混合讀寫(讀寫7:3):讀iops=1114 寫iops=4791m 順序?qū)?iops=1701m 順序讀:iops=246 1m 順序讀寫(讀寫7:3):讀iops=134 寫iops=56


咨詢
建站咨詢
