前言 fio是測試IOPS的非常好的工具,用來對硬體進行壓力測試和驗證,支持13種不同的I/O引擎,包括:sync,mmap, libaio, posixaio, SG v3, splice, null, network, syslet, guasi, solarisaio 等等。 測試準備 工具: ...
前言
fio是測試IOPS的非常好的工具,用來對硬體進行壓力測試和驗證,支持13種不同的I/O引擎,包括:sync,mmap, libaio, posixaio, SG v3, splice, null, network, syslet, guasi, solarisaio 等等。
測試準備
工具:fio - Flexible IO Tester
官方網站:
http://freecode.com/projects/fio
註意: 性能測試建議直接通過寫裸盤的方式進行測試,會得到較為真實的數據。但直接測試裸盤會破壞文件系統結構,導致數據丟失,請在測試前確認磁碟中數據已備份。
CentOS可以直接使用yum安裝
#yum安裝
yum install libaio-devel fio
#手動安裝
yum install libaio-devel
wget http://brick.kernel.dk/snaps/fio-2.2.10.tar.gz
tar -zxvf fio-2.2.10.tar.gz
cd fio-2.2.10
make $ make install
For gfio, gtk 2.18 (or newer), associated glib threads, and cairo are required
to be installed. gfio isn't built automatically and can be enabled
with a --enable-gfio option to configure.
示例:
對磁碟進行1024K順序寫
fio cap_1024K_seq_write
[global]
ioengine=libaio
bs=1024K
rw=write
ramp_time=6
runtime=300
direct=1
iodepth=16
#rwmixwrite=20
time_based
[test]
filename=/dev/sda
numjobs=1
結果:
test: (g=0): rw=write, bs=1M-1M/1M-1M/1M-1M, ioengine=libaio, iodepth=16
fio-2.8
Starting 1 process
Jobs: 1 (f=1): [W(1)] [100.0% done] [0KB/68198KB/0KB /s] [0/66/0 iops] [eta 00m:00s]
test: (groupid=0, jobs=1): err= 0: pid=4676: Thu Apr 7 17:22:37 2016
write: io=20075MB, bw=68464KB/s, iops=66, runt=300255msec #執行多少IO,平均帶寬,線程運行時間
slat (usec): min=51, max=5732, avg=291.11, stdev=262.47 #提交延遲
clat (usec): min=1, max=2235.8K, avg=239043.28, stdev=153384.41 #完成延遲
lat (usec): min=367, max=2235.9K, avg=239337.72, stdev=153389.57 #響應時間
clat percentiles (usec):
| 1.00th=[ 221], 5.00th=[ 442], 10.00th=[ 1004], 20.00th=[108032],
| 30.00th=[228352], 40.00th=[248832], 50.00th=[257024], 60.00th=[268288],
| 70.00th=[280576], 80.00th=[301056], 90.00th=[342016], 95.00th=[477184],
| 99.00th=[806912], 99.50th=[864256], 99.90th=[1122304], 99.95th=[1171456],
| 99.99th=[1646592]
bw (KB /s): min= 170, max=204800, per=100.00%, avg=68755.07, stdev=27034.84
lat (usec) : 2=0.01%, 4=0.13%, 50=0.06%, 100=0.26%, 250=1.04%
lat (usec) : 500=4.53%, 750=2.61%, 1000=1.33%
lat (msec) : 2=1.18%, 4=0.15%, 10=0.77%, 20=0.77%, 50=1.50%
lat (msec) : 100=4.43%, 250=23.48%, 500=53.23%, 750=3.09%, 1000=1.30%
lat (msec) : 2000=0.19%, >=2000=0.01%
cpu : usr=0.03%, sys=2.11%, ctx=19066, majf=0, minf=7
IO depths : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.1%, 16=103.8%, 32=0.0%, >=64=0.0% #io隊列
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0% #單個IO提交要提交的IO數
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.1%, 32=0.0%, 64=0.0%, >=64=0.0%
issued : total=r=0/w=20060/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=16 #IO完延遲的分佈
Run status group 0 (all jobs):
WRITE: io=20075MB, aggrb=68464KB/s(group總帶寬), minb=68464KB/s(最小平均帶寬), maxb=68464KB/s(最大平均帶寬), mint=300255msec(group中線程的最短運行時間), maxt=300255msec(group中線程的最長運行時間)
Disk stats (read/write):
sda: ios=23/41769(所有group總共執行的IO數), merge=0/149(總共發生的IO合併數), ticks=706/9102766(Number of ticks we kept the disk busy), in_queue=9105836(花費在隊列上的總共時間), util=100.00%(磁碟利用率)
FAQ:
1.執行報:No package 'gtk+-2.0' found,No package 'gthread-2.0' found,configure: gtk and gthread not found
A:yum install gtk2-devel
2.執行fio -name test -runtime=30 -filename=/dev/sda3 -ioengine=libaio -direct=1 -bs=1024K -iodepth=16 -rw=write -time_based:
報:fio: /dev/sda3 appears mounted, and 'allow_mounted_write' isn't set. Aborting.
A:對sda壓測