如何測(cè)試云主機(jī)的磁盤IO性能?
磁盤IO是云主機(jī)的重要指標(biāo),可以按照負(fù)載情況分成照順序讀寫,隨機(jī)讀寫兩大類。
fio 是測(cè)試磁盤性能的***工具:
1、測(cè)試順序讀性能
- fio --filename=/home/test -iodepth=64 -ioengine=libaio --direct=1 --rw=read --bs=1m --size=2g --numjobs=4 --runtime=10 --group_reporting --name=test-read
2、測(cè)試順序?qū)懶阅?/strong>
- fio -filename=/home/test -iodepth=64 -ioengine=libaio -direct=1 -rw=write -bs=1m -size=2g -numjobs=4 -runtime=20 -group_reporting -name=test-write
3、測(cè)試隨機(jī)讀性能
- fio -filename=/home/test -iodepth=64 -ioengine=libaio -direct=1 -rw=randread -bs=4k -size=2G -numjobs=64 -runtime=20 -group_reporting -name=test-rand-read
4、測(cè)試隨機(jī)寫性能
- fio -filename=/home/test -iodepth=64 -ioengine=libaio -direct=1 -rw=randwrite -bs=4k -size=2G -numjobs=64 -runtime=20 -group_reporting -name=test-rand-write
參數(shù)說(shuō)明:
- filename=/home/test 測(cè)試文件名稱,通常選擇需要測(cè)試的盤的data目錄。
- direct=1 測(cè)試過(guò)程繞過(guò)機(jī)器自帶的buffer。使測(cè)試結(jié)果更真實(shí)。
- rw=randwrite 測(cè)試隨機(jī)寫的I/O
- rw=randrw 測(cè)試隨機(jī)寫和讀的I/O
- bs=4k 單次io的塊文件大小為4k
- size=2g 本次的測(cè)試文件大小為2g,以每次4k的io進(jìn)行測(cè)試。
- numjobs=64 本次的測(cè)試線程為64.
- runtime=20 測(cè)試時(shí)間為20秒,如果不寫則一直將2g文件分4k每次寫完為止。
報(bào)告如何查看:
fio的結(jié)果報(bào)告內(nèi)容豐富,我們主要關(guān)心的是兩項(xiàng):
- 磁盤的吞吐量bw,這個(gè)是順序讀寫考察的重點(diǎn)
- 磁盤的每秒讀寫次數(shù)iops,這個(gè)是隨機(jī)讀寫考察的重點(diǎn)
比如,下面是4個(gè)測(cè)試的結(jié)果部分截?。?/p>
test-read: (groupid=0, jobs=4): err= 0: pid=4752 read : io=839680KB, bw=76823KB/s, iops=75 , runt= 10930msec
順序讀,帶寬76823KB/s,iops 75
test-write: (groupid=0, jobs=4): err= 0: pid=4758 write: io=899072KB, bw=42854KB/s, iops=41 , runt= 20980msec
順序?qū)?,帶?2854KB/s, iops=41
test-rand-read: (groupid=0, jobs=64): err= 0: pid=4619 read : io=72556KB, bw=3457.4KB/s, iops=864 , runt= 20986msec
隨機(jī)讀,帶寬3457.4KB/s, iops=864
test-rand-write: (groupid=0, jobs=64): err= 0: pid=4685 write: io=129264KB, bw=6432.4KB/s, iops=1608 , runt= 20097msec
隨機(jī)寫,帶寬6432.4KB/s, iops=1608。






















