fio安裝和使用方法

一、fio介紹

fio 是一個 I/O 工具用來對硬件進行壓力測試和驗證,是一款Linux平臺上頗爲專業的磁盤性能測試工具,其測試數據十分具有參考價值。支持13種不同的I/O引擎,包括:sync, mmap, libaio, posixaio, SG v3, splice, null, network, syslet, guasi, solarisaio 等等, I/O priorities (for newer Linux kernels), rate I/O, forked or threaded jobs等。

二、安裝

這裏使用的是源碼包安裝。下載地址:

鏈接: http://pan.baidu.com/s/1ntpyXfj 密碼: odgq

這裏使用的系統是RedHat 6或CentOs 6

首先,需要安裝gcc編譯器,搭建好yum源,yum install gcc* 確定安裝即可。

把fio上傳到Linux系統中,注意,使用ftp上傳的時候,需使用binary二進制模式

爲了避免權限問題,可以把fio文件權限改爲755,chmod 755 fio-2.1.7.tar.gz

tar -zxvf fio-2.1.7.tar.gz//解壓

cd fio-2.1.7

./configure

make

make install

裝好即可。


[root@zhou ~]# fio

No jobs(s) defined


fio-2.1.7

fio [options] [job options] <job file(s)>

 --debug=options       Enable debug logging. May be one/more of:

                       process,file,io,mem,blktrace,verify,random,parse,

                       diskutil,job,mutex,profile,time,net,rate

 --parse-only          Parse options only, don't start any IO

 --output              Write output to file

 --runtime             Runtime in seconds

 --latency-log         Generate per-job latency logs

 --bandwidth-log       Generate per-job bandwidth logs

 --minimal             Minimal (terse) output

 --output-format=x     Output format (terse,json,normal)

 --terse-version=x     Set terse version output format to 'x'

 --version             Print version info and exit

 --help                Print this page

 --cpuclock-test       Perform test/validation of CPU clock

 --crctest             Test speed of checksum functions

 --cmdhelp=cmd         Print command help, "all" for all of them

 --enghelp=engine      Print ioengine help, or list available ioengines

 --enghelp=engine,cmd  Print help for an ioengine cmd

 --showcmd             Turn a job file into command line options

 --eta=when            When ETA estimate should be printed

                       May be "always", "never" or "auto"

 --eta-newline=time    Force a new line for every 'time' period passed

 --status-interval=t   Force full status dump every 't' period passed

 --readonly            Turn on safety read-only checks, preventing writes

 --section=name        Only run specified section in job file

 --alloc-size=kb       Set smalloc pool to this size in kb (def 1024)

 --warnings-fatal      Fio parser warnings are fatal

 --max-jobs=nr         Maximum number of threads/processes to support

 --server=args         Start a backend fio server

 --daemonize=pidfile   Background fio server, write pid to file

 --client=hostname     Talk to remote backend fio server at hostname

 --idle-prof=option    Report cpu idleness on a system or percpu basis

                       (option=system,percpu) or run unit work

                       calibration only (option=calibrate)


Fio was written by Jens Axboe <[email protected]>

                  Jens Axboe <[email protected]>

                  Jens Axboe <[email protected]>

三、使用方法


▲隨機讀:

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


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章