Litao OK Blog

A little blog for my life.

测试磁盘的IOPS

1
fio -filename=/dev/sda -direct=1 -iodepth 1 -thread -rw=randread -ioengine=psync -bs=16k -size=5G -numjobs=30 -runtime=1000 -group_reporting -name=mytest

示例结果:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
mytest: (g=0): rw=randread, bs=16K-16K/16K-16K/16K-16K, ioengine=psync, iodepth=1
...
mytest: (g=0): rw=randread, bs=16K-16K/16K-16K/16K-16K, ioengine=psync, iodepth=1
fio-2.0.13
Starting 30 threads
Jobs: 30 (f=30): [rrrrrrrrrrrrrrrrrrrrrrrrrrrrrr] [100.0% done] [4464K/0K/0K /s] [279 /0 /0  iops] [eta 00m:00s]
mytest: (groupid=0, jobs=30): err= 0: pid=17982: Tue May 19 14:18:07 2015
  read : io=4328.5MB, bw=4431.6KB/s, iops=276 , runt=1000189msec
    clat (usec): min=119 , max=3050.7K, avg=108296.76, stdev=121702.40
     lat (usec): min=119 , max=3050.7K, avg=108296.98, stdev=121702.40
    clat percentiles (msec):
     |  1.00th=[    6],  5.00th=[    9], 10.00th=[   12], 20.00th=[   21],
     | 30.00th=[   32], 40.00th=[   46], 50.00th=[   65], 60.00th=[   90],
     | 70.00th=[  124], 80.00th=[  176], 90.00th=[  269], 95.00th=[  359],
     | 99.00th=[  570], 99.50th=[  660], 99.90th=[  775], 99.95th=[  791],
     | 99.99th=[  816]
    bw (KB/s)  : min=    6, max=  524, per=3.44%, avg=152.44, stdev=70.00
    lat (usec) : 250=0.03%, 500=0.07%, 750=0.01%
    lat (msec) : 2=0.01%, 4=0.04%, 10=7.25%, 20=12.28%, 50=23.02%
    lat (msec) : 100=20.78%, 250=25.17%, 500=9.65%, 750=1.52%, 1000=0.17%
    lat (msec) : 2000=0.01%, >=2000=0.01%
  cpu          : usr=0.00%, sys=0.01%, ctx=266799, majf=18446744073709551466, minf=18446744073708222853
  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=277022/w=0/d=0, short=r=0/w=0/d=0

Run status group 0 (all jobs):
   READ: io=4328.5MB, aggrb=4431KB/s, minb=4431KB/s, maxb=4431KB/s, mint=1000189msec, maxt=1000189msec

Disk stats (read/write):
  sda: ios=277006/100, merge=0/141, ticks=29993265/10330436, in_queue=40378421, util=100.00%

通过结算可以了解该磁盘每天最高只能承受2400万次IO请求,所以要做静态化来提高服务器处理能力建议使用SSD硬盘,非SSD硬盘可以考虑缓存方式(即利用内存的高IO)