天天看點

CentOS評估磁盤I/O性能讀寫極限測試

用一個fio工具

安裝

yum -y install fio

二,FIO用法:

随機讀:

fio  -direct=1 -iodepth 1 -thread -rw=randread -ioengine=psync -bs=16k -size=20G -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  -direct=1 -iodepth 1 -thread -rw=read -ioengine=psync -bs=16k -size=200G -numjobs=30 -runtime=1000 -group_reporting -name=mytest

随機寫:

fio -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

三,實際測試範例:

[root@localhost ~]# 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=mytest1

中間會報錯了

mytest: Laying out IO file(s) (1 file(s) / 2048MB)

fio: pid=0, err=2/file:filesetup.c:79, func=open, error=No such file or directory

========================

把檔案名參數 -filename=/dev/sdb1 幹掉

======================================

[root@localhost tmp]# fio -direct=1 -iodepth 1 -thread -rw=randread -ioengine=psync -bs=16k -size=2G -numjobs=10 -runtime=5 -group_reporting -name=mytest

mytest: (g=0): rw=randread, bs=16K-16K/16K-16K/16K-16K, ioengine=psync, iodepth=1

...

fio-2.2.8

Starting 10 threads

Jobs: 10 (f=10): [r(10)] [100.0% done] [3152KB/0KB/0KB /s] [197/0/0 iops] [eta 00m:00s]

mytest: (groupid=0, jobs=10): err= 0: pid=15442: Thu Sep 24 16:51:05 2015

read : io=14784KB, bw=2918.3KB/s, iops=182, runt= 5066msec

clat (msec): min=3, max=460, avg=54.41, stdev=63.26

lat (msec): min=3, max=460, avg=54.41, stdev=63.26

clat percentiles (msec):

| 1.00th=[ 5], 5.00th=[ 9], 10.00th=[ 11], 20.00th=[ 16],

| 30.00th=[ 19], 40.00th=[ 24], 50.00th=[ 31], 60.00th=[ 43],

| 70.00th=[ 56], 80.00th=[ 80], 90.00th=[ 128], 95.00th=[ 184],

| 99.00th=[ 338], 99.50th=[ 379], 99.90th=[ 461], 99.95th=[ 461],

| 99.99th=[ 461]

bw (KB /s): min= 98, max= 593, per=10.18%, avg=297.06, stdev=109.73

lat (msec) : 4=0.76%, 10=7.03%, 20=25.76%, 50=32.03%, 100=19.59%

lat (msec) : 250=12.77%, 500=2.06%

cpu : usr=0.01%, sys=0.13%, ctx=942, majf=0, minf=41

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 : total=r=924/w=0/d=0, short=r=0/w=0/d=0, drop=r=0/w=0/d=0

latency : target=0, window=0, percentile=100.00%, depth=1

Run status group 0 (all jobs):

READ: io=14784KB, aggrb=2918KB/s, minb=2918KB/s, maxb=2918KB/s, mint=5066msec, maxt=5066msec

Disk stats (read/write):

dm-1: ios=905/2, merge=0/0, ticks=53056/149, in_queue=53856, util=98.12%, aggrios=928/3, aggrmerge=0/0, aggrticks=55020/149, aggrin_queue=55168, aggrutil=97.95%

sda: ios=928/3, merge=0/0, ticks=55020/149, in_queue=55168, util=97.95%

繼續閱讀