测试工具:fio
参数:
- filename=/dev/vda/test.big # 测试文件;
- direct=1 # 测试过程绕过机器自带的buffer;
- rw=randwrite # 随机写的I/O;
- rw=randrw # 随机写和读的I/O;
- bs=4K # I/O块文件大小为4K对齐;
- size=8G # 文件大小为8G ,以每次4K的I/O进行测试;
- numjobs=64 # 线程为64;
- runtime=20 # 时间为20秒;
- ioengine=psync # I/O引擎使用pync方式;
- rwmixwrite=30 # 混合读写的模式下,写占30%;
- group_reporting # 显示结果的,汇总每个进程的信息;
- sync=1 # 异步I/O;
- fsync=1 # 一个I/O就同步数据;
[zhupengfei@devops-centos8-shanghai-area2 packages ]$ dnf install -y libaio libaio-devel
[zhupengfei@devops-centos8-shanghai-area2 packages ]$ wget https://brick.kernel.dk/snaps/fio-3.10.tar.gz
[zhupengfei@devops-centos8-shanghai-area2 packages ]$ tar -zxxf fio-3.10.tar.gz && cd fio-3.10
[zhupengfei@devops-centos8-shanghai-area2 fio-3.10 ]$ sudo ./configure
[zhupengfei@devops-centos8-shanghai-area2 fio-3.10 ]$ sudo make && make install
[zhupengfei@devops-centos8-shanghai-area2 fio-3.10 ]$ sudo fio -filename=/dev/vda -direct=1 -iodepth 1 -thread -rw=write -ioengine=libaio -bs=1024k -size=8G -numjobs=4 -runtime=60 -group_reporting -name=checkdisk
checkdisk: (g=0): rw=write, bs=(R) 1024KiB-1024KiB, (W) 1024KiB-1024KiB, (T) 1024KiB-1024KiB, ioengine=libaio, iodepth=1
...
fio-3.10
Starting 4 threads
Jobs: 4 (f=4): [W(4)][100.0%][w=114MiB/s][w=114 IOPS][eta 00m:00s]
checkdisk: (groupid=0, jobs=4): err= 0: pid=7237: Mon Apr 26 10:47:35 2021
write: IOPS=112, BW=113MiB/s (118MB/s)(6765MiB/60009msec)
slat (usec): min=69, max=87376, avg=199.87, stdev=1880.42
clat (msec): min=6, max=896, avg=35.27, stdev=35.49
lat (msec): min=6, max=896, avg=35.47, stdev=35.51
clat percentiles (msec):
| 1.00th=[ 9], 5.00th=[ 11], 10.00th=[ 11], 20.00th=[ 12],
| 30.00th=[ 13], 40.00th=[ 14], 50.00th=[ 16], 60.00th=[ 18],
| 70.00th=[ 70], 80.00th=[ 74], 90.00th=[ 78], 95.00th=[ 80],
| 99.00th=[ 83], 99.50th=[ 85], 99.90th=[ 197], 99.95th=[ 567],
| 99.99th=[ 894]
bw ( KiB/s): min= 2048, max=32768, per=24.99%, avg=28844.22, stdev=3393.60, samples=480
iops : min= 2, max= 32, avg=28.12, stdev= 3.32, samples=480
lat (msec) : 10=4.48%, 20=59.32%, 50=1.48%, 100=34.53%, 250=0.12%
lat (msec) : 500=0.01%, 750=0.01%, 1000=0.04%
cpu : usr=0.26%, sys=0.20%, ctx=6805, majf=0, minf=4
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 rwts: total=0,6765,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
WRITE: bw=113MiB/s (118MB/s), 113MiB/s-113MiB/s (118MB/s-118MB/s), io=6765MiB (7094MB), run=60009-60009msec
Disk stats (read/write):
vda: ios=133/90314, merge=0/365, ticks=1352/2647495, in_queue=2354203, util=89.09%
进一步可参阅:阿里云存储I/O性能资料
吞吐量=IOPS * I/O大小,磁盘I/O越大,IOPS越高,每秒I/O的吞吐量越高,云服务器认为IOPS和吞吐量的数值越高越好,实际上磁盘IOPS和吞吐量两个参数是有其最大值的。