【MySQL】FIO測試磁盤IOPS

前言:想到之前用sysbench測試過服務(wù)器硬盤IOPS,但是沒有指定數(shù)據(jù)塊大小,所以最近又另外找了fio工具來測試服務(wù)器磁盤IOPS。

一、fio安裝

官網(wǎng)下載最新fio工具,編譯安裝即可
解壓

tar -zxvf fio-2.1.10.tar.gz

安裝

make
make install

二、測試

filename=/dev/emcpowerb 支持文件系統(tǒng)或者裸設(shè)備,-filename=/dev/sda2或-filename=/dev/sdb
direct=1                 測試過程繞過機(jī)器自帶的buffer,使測試結(jié)果更真實(shí)
rw=randwread             測試隨機(jī)讀的I/O
rw=randwrite             測試隨機(jī)寫的I/O
rw=randrw                測試隨機(jī)混合寫和讀的I/O
rw=read                  測試順序讀的I/O
rw=write                 測試順序?qū)懙腎/O
rw=rw                    測試順序混合寫和讀的I/O
bs=4k                    單次io的塊文件大小為4k
bsrange=512-2048         同上,提定數(shù)據(jù)塊的大小范圍
size=5g                  本次的測試文件大小為5g,以每次4k的io進(jìn)行測試
numjobs=30               本次的測試線程為30
runtime=1000             測試時(shí)間為1000秒,如果不寫則一直將5g文件分4k每次寫完為止
ioengine=psync           io引擎使用pync方式,如果要使用libaio引擎,需要yum install libaio-devel包
rwmixwrite=30            在混合讀寫的模式下,寫占30%
group_reporting          關(guān)于顯示結(jié)果的,匯總每個(gè)進(jìn)程的信息
此外
lockmem=1g               只使用1g內(nèi)存進(jìn)行測試
zero_buffers             用0初始化系統(tǒng)buffer
nrfiles=8                每個(gè)進(jìn)程生成文件的數(shù)量

實(shí)際測試:

[root@Mariadb-04 fio-2.1.10]# /usr/local/bin/fio -filename=/storage/test_randread -direct=1 -iodepth 1 -thread -rw=randrw -rwmixread=70 -ioengine=psync -bs=16k -size=2G -numjobs=30 -runtime=120 -group_reporting -name=mytest  

三、結(jié)果解讀

...
fio-2.1.10
Starting 30 threads
mytest: Laying out IO file(s) (1 file(s) / 2048MB)
Jobs: 30 (f=30): [mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] [100.0% done] [96239KB/42997KB/0KB /s] [6014/2687/0 iops] [eta 00m:00s]
mytest: (groupid=0, jobs=30): err= 0: pid=32902: Wed Apr 25 11:01:28 2018
  read : io=3498.2MB, bw=29841KB/s, iops=1865, runt=120039msec
    clat (usec): min=95, max=7180.4K, avg=13934.48, stdev=106872.83
     lat (usec): min=95, max=7180.4K, avg=13934.66, stdev=106872.84
    clat percentiles (usec):
     |  1.00th=[  115],  5.00th=[  133], 10.00th=[  161], 20.00th=[  235],
     | 30.00th=[  318], 40.00th=[  652], 50.00th=[ 5024], 60.00th=[ 8640],
     | 70.00th=[12864], 80.00th=[19840], 90.00th=[32384], 95.00th=[46336],
     | 99.00th=[84480], 99.50th=[107008], 99.90th=[209920], 99.95th=[1253376],
     | 99.99th=[5210112]
    bw (KB  /s): min=    2, max= 5447, per=4.09%, avg=1221.31, stdev=688.71
  write: io=1513.9MB, bw=12914KB/s, iops=807, runt=120039msec
    clat (usec): min=179, max=7160.4K, avg=4952.37, stdev=109858.64
     lat (usec): min=180, max=7160.4K, avg=4954.63, stdev=109858.67
    clat percentiles (usec):
     |  1.00th=[  286],  5.00th=[  326], 10.00th=[  358], 20.00th=[  406],
     | 30.00th=[  446], 40.00th=[  494], 50.00th=[  564], 60.00th=[  700],
     | 70.00th=[ 1192], 80.00th=[ 4896], 90.00th=[ 8512], 95.00th=[10048],
     | 99.00th=[16064], 99.50th=[18560], 99.90th=[44288], 99.95th=[1253376],
     | 99.99th=[7176192]
    bw (KB  /s): min=    2, max= 2821, per=4.14%, avg=534.19, stdev=334.76
    lat (usec) : 100=0.01%, 250=16.05%, 500=21.96%, 750=9.53%, 1000=2.97%
    lat (msec) : 2=3.48%, 4=3.07%, 10=16.50%, 20=12.44%, 50=11.02%
    lat (msec) : 100=2.51%, 250=0.37%, 500=0.02%, 1000=0.01%, 2000=0.01%
    lat (msec) : >=2000=0.05%
  cpu          : usr=0.04%, sys=0.25%, ctx=325441, majf=0, minf=6
  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=223880/w=96886/d=0, short=r=0/w=0/d=0
     latency   : target=0, window=0, percentile=100.00%, depth=1

Run status group 0 (all jobs):
   READ: io=3498.2MB, aggrb=29840KB/s, minb=29840KB/s, maxb=29840KB/s, mint=120039msec, maxt=120039msec
  WRITE: io=1513.9MB, aggrb=12913KB/s, minb=12913KB/s, maxb=12913KB/s, mint=120039msec, maxt=120039msec

Disk stats (read/write):
    dm-1: ios=231005/101135, merge=0/0, ticks=3413245/925615, in_queue=4340282, util=100.00%, aggrios=231734/101432, aggrmerge=32/11, aggrticks=3416960/876818, aggrin_queue=4293134, aggrutil=100.00%
    dm-0: ios=231734/101432, merge=32/11, ticks=3416960/876818, in_queue=4293134, util=100.00%, aggrios=231734/101432, aggrmerge=0/0, aggrticks=2391410/76306, aggrin_queue=2467258, aggrutil=100.00%
  sdb: ios=231734/101432, merge=0/0, ticks=2391410/76306, in_queue=2467258, util=100.00%

這里我們只需要關(guān)注read iops=1865與write iops=807就可以了。

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容