磁盘性能测试

Abstract

心血来潮,想测试一下阿里云的essd 和阿里云的本地ssd 性能, 不巧的是阿里云ecs 的存储, 有几种类型, essd, ssd 云盘, 高效云盘 和本地盘nvme 盘
最终测试下来确实nvme 盘的性能最好。

测试工具: 本文用sysbench 进行测试, 以前读书的时候使用过iometer 进行测试, sysbench 测试参数更多, 对iops 的测试效果更丰富, iometer 偏重吞吐量的测试。

介绍

参考之前的博文, 学会如何安装sysbench

准备工作

测试脚本

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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash

SYSBENCH_FILE_TOTAL_SIZE=16G
SYSBENCH_FILE_NUM=16
SYSBENCH_NUM_THREADS=16
FSYNC=off
SYSBENCH_BLOCK_SIZE=4096
SYSBENCH_TIME=60

# --file-num=N number of files to create [128]
# --file-block-size=N block size to use in all IO operations [16384]
# --file-total-size=SIZE total size of files to create [2G]
# --file-test-mode=STRING test mode {seqwr, seqrewr, seqrd, rndrd, rndwr, rndrw}
# --file-io-mode=STRING file operations mode {sync,async,mmap} [sync]
# --file-extra-flags=[LIST,...] list of additional flags to use to open files {sync,dsync,direct} []
# --file-fsync-freq=N do fsync() after this number of requests (0 - don't use fsync()) [100]
# --file-fsync-all[=on|off] do fsync() after each write operation [off]
# --file-fsync-end[=on|off] do fsync() at the end of test [on]
# --file-fsync-mode=STRING which method to use for synchronization {fsync, fdatasync} [fsync]
# --file-merged-requests=N merge at most this number of IO requests if possible (0 - don't merge) [0]
# --file-rw-ratio=N reads/writes ratio for combined test [1.5]

testmodes=(
"seqwr"
"seqrewr"
"seqrd"
"rndrd"
"rndwr"
"rndrw"
)
for testmode in "${testmodes[@]}"
do
directios=(
""
"sync"
"direct"
"dsync"
)
for directio in "${directios[@]}"
do
date
echo 1 > /proc/sys/vm/drop_caches
echo "begin to run $testmode $directio"
sysbench fileio --file-num=$SYSBENCH_FILE_NUM --file-block-size=$SYSBENCH_BLOCK_SIZE --file-total-size=$SYSBENCH_FILE_TOTAL_SIZE --file-test-mode=$testmode --file-io-mode=sync --file-extra-flags=$directio --file-fsync-all=$FSYNC --file-fsync-mode=fsync --file-fsync-freq=0 --file-merged-requests=0 --threads=$SYSBENCH_NUM_THREADS prepare
sysbench fileio --file-num=$SYSBENCH_FILE_NUM --file-block-size=$SYSBENCH_BLOCK_SIZE --file-total-size=$SYSBENCH_FILE_TOTAL_SIZE --file-test-mode=$testmode --file-io-mode=sync --file-extra-flags=$directio --file-fsync-all=$FSYNC --file-fsync-mode=fsync --file-fsync-freq=0 --file-merged-requests=0 --report-interval=10 --threads=$SYSBENCH_NUM_THREADS --time=$SYSBENCH_TIME run
sysbench fileio --file-num=$SYSBENCH_FILE_NUM --file-block-size=$SYSBENCH_BLOCK_SIZE --file-total-size=$SYSBENCH_FILE_TOTAL_SIZE --file-test-mode=$testmode --file-io-mode=sync --file-extra-flags=$directio --file-fsync-all=$FSYNC --file-fsync-mode=fsync --file-fsync-freq=0 --file-merged-requests=0 cleanup
date
esynccho "Finish one loop test"
done
done

rm -rf test_file.*

echo "Finish all test"