Skip to main content

FIO测试IOPS

Linux IOPS 测试工具 FIO

安装

Yum

yum install -y fio  

Binary

官网

wget http://freecode.com/urls/3aa21b8c106cab742bf1f20d60629e3f  
tar xvzf 3aa21b8c106cab742bf1f20d60629e3f  
cd fio-2.1.10/  
yum -y install libaio-devel  
make && make install  

参数

-filename

-filename=/dev/sdb1 压力测试的文件,选择磁盘路径(df -h)

-direct

-direct=1 通常使用这种方式来绕过磁盘的缓存,得到更为真实的IOPS数据

-rw

-rw=randwrite 随机写 -rw=randrw 随机读写 -rw=randread 随机读 -rw=read 顺序读 -rw=write 顺序写 -rw=rw 顺序读写

-ioengine

-ioengine=libaio 读写引擎 其他还提供sync , psync , vsync , posixaio , mmap , splice , syslet-rw , sg , null , net , netsplice , cpuio , guasi , external 等方式

-bs

-bs=4k 写入文件块大小

-rwmixread

-rwmixread=100 混合读写的时候读占据总数的比例%。

-iodepth

-iodepth=16 同一時間有多少 I/O 在做存取,越多不代表存儲裝置表現會更好,通常是 RAID 時須要設大一點.

-numjobs

–numjobs=16 跟前面的 iodepth 類似,但不一樣,在 Linux 下每一個 job 可以生出不同的 processes/threads ,numjobs 就是在同一個 workload 同時提出多個 I/O 請求,通常負載這個會比較大.預設值為 1.

-runtime

-runtime=100 测试执行时间

-group_reporting

-group_reporting 数据报告的展示方式,不设置的话会把每个线程单独展示

-name

-name=test 测试名称

测试磁盘性能

fio -filename=/dev/mapper/vg_zj2030-lv_home -rw=randrw -ioengine=libaio -bs=4k -rwmixread=70 -iodepth=4 -numjobs=8 -runtime=120 -group_reporting -name=randtest  

结果

[root@cansdk test]# fio -filename=/dev/mapper/vg_zj2030-lv_home -rw=randrw -ioengine=libaio -bs=4k -rwmixread=70 -iodepth=4 -numjobs=8 -runtime=120 -group_reporting -name=randtest
randtest: (g=0): rw=randrw, bs=4K-4K/4K-4K/4K-4K, ioengine=libaio, iodepth=4  
...
randtest: (g=0): rw=randrw, bs=4K-4K/4K-4K/4K-4K, ioengine=libaio, iodepth=4  
fio-2.0.13  
Starting 8 processes  
Jobs: 8 (f=8): [mmmmmmmm] [100.0% done] [284K/100K/0K /s] [71 /25 /0  iops] [eta 00m:00s]  
randtest: (groupid=0, jobs=8): err= 0: pid=19057: Fri Sep  2 03:13:42 2016  
  read : io=30464KB, bw=258782 B/s, iops=63 , runt=120546msec
    slat (msec): min=4 , max=1127 , avg=124.43, stdev=74.88
    clat (usec): min=4 , max=2040.4K, avg=260635.10, stdev=156093.20
     lat (msec): min=7 , max=2521 , avg=385.07, stdev=185.30
    clat percentiles (usec):
     |  1.00th=[   35],  5.00th=[35072], 10.00th=[102912], 20.00th=[130560],
     | 30.00th=[211968], 40.00th=[234496], 50.00th=[250880], 60.00th=[276480],
     | 70.00th=[325632], 80.00th=[362496], 90.00th=[387072], 95.00th=[415744],
     | 99.00th=[954368], 99.50th=[1089536], 99.90th=[1581056], 99.95th=[1810432],
     | 99.99th=[2039808]
    bw (KB/s)  : min=    1, max=  160, per=12.83%, avg=32.32, stdev=11.78
  write: io=13052KB, bw=110872 B/s, iops=27 , runt=120546msec
    slat (usec): min=4 , max=35 , avg=10.47, stdev= 3.94
    clat (usec): min=19 , max=1811.6K, avg=258935.24, stdev=151875.68
     lat (usec): min=25 , max=1811.6K, avg=258945.90, stdev=151875.52
    clat percentiles (usec):
     |  1.00th=[   23],  5.00th=[44800], 10.00th=[101888], 20.00th=[132096],
     | 30.00th=[209920], 40.00th=[234496], 50.00th=[248832], 60.00th=[276480],
     | 70.00th=[325632], 80.00th=[358400], 90.00th=[387072], 95.00th=[411648],
     | 99.00th=[946176], 99.50th=[1056768], 99.90th=[1597440], 99.95th=[1630208],
     | 99.99th=[1810432]
    bw (KB/s)  : min=    1, max=  122, per=15.43%, avg=16.67, stdev=11.77
    lat (usec) : 10=0.06%, 20=0.03%, 50=2.67%, 100=0.04%, 250=0.01%
    lat (msec) : 10=0.12%, 20=0.75%, 50=2.10%, 100=3.63%, 250=39.99%
    lat (msec) : 500=48.68%, 750=0.40%, 1000=0.74%, 2000=0.78%, >=2000=0.01%
  cpu          : usr=0.03%, sys=0.08%, ctx=8103, majf=0, minf=201
  IO depths    : 1=0.1%, 2=0.1%, 4=99.8%, 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=7616/w=3263/d=0, short=r=0/w=0/d=0

Run status group 0 (all jobs):  
   READ: io=30464KB, aggrb=252KB/s, minb=252KB/s, maxb=252KB/s, mint=120546msec, maxt=120546msec
  WRITE: io=13052KB, aggrb=108KB/s, minb=108KB/s, maxb=108KB/s, mint=120546msec, maxt=120546msec