Sysbench 基准压测 IO篇
Posted 米豆小书童
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Sysbench 基准压测 IO篇相关的知识,希望对你有一定的参考价值。
- line:V1.1
- mail: [email protected]
- date: 2017-11-17
一、Sysench测试前准备
1.1、压测环境
配置 | 信息 |
---|---|
主机 | Dell PowerEdge R730xd |
CPU | 24 * Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz |
内存 | 64G (16G * 4) |
RAID | RAID1 |
硬盘 | 7.2K RPM, 6000G SAS, 12G/s |
文件系统 | ext4 |
系统 | Red Hat Enterprise Linux Server release 7.3 (Maipo) |
内核 | 3.10.0-514.el7.x86_64 |
Sysbench | 1.1.0-0167e45 |
1.2、压测基准值
Tools | sysbench |
---|---|
time(sec) | 180 |
events | 100000000 |
threads | 24 |
file-total-size | 128G |
file-test-mode | rndrw(随机读写)、rndwr(随机写)、rndrd (随机读) |
file-extra-flags | O_DIRECT |
file-fsync-freq | 0 |
file-block-size | 16K |
二、进行OLTP_IO测试
2.1、安装压测工具sysbench
- 标准安装
[[email protected](252) /r2/soft/dbtest] curl -s https://packagecloud.io/install/repositories/akopytov/sysbench/script.rpm.sh | sudo bash &&
sudo yum -y install sysbench
2.2、执行压测
- 2.2.1 创建128个表,并发线程数24个,总数据量128G
[[email protected](252) /r2/soft/sysbench]# sysbench --threads=24 --test=fileio --file-total-size=128G --file-test-mode=rndrw prepare
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
sysbench 1.1.0-0167e45 (using bundled LuaJIT 2.1.0-beta3)
128 files, 1048576Kb each, 131072Mb total
Creating files for the test...
Extra file open flags: 0
Creating file test_file.0
......
Creating file test_file.127
- 2.2.2 进行fileio(rndrw随机读写)测试
[[email protected](252) /r2/soft/sysbench]# sysbench fileio > --time=180 > --events=100000000 > --threads=24 > --file-total-size=128G > --file-test-mode=rndrw > --file-num=128 > --file-extra-flags=direct > --file-fsync-freq=0 > --file-block-size=16384 > run
sysbench 1.1.0-0167e45 (using bundled LuaJIT 2.1.0-beta3)
Running the test with following options:
Number of threads: 24
Initializing random number generator from current time
Extra file open flags: 3
128 files, 1GiB each
128GiB total file size
Block size 16KiB
Number of IO requests: 100000000
Read/Write ratio for combined random IO test: 1.50
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing random r/w test
Initializing worker threads...
Threads started!
Throughput:
read: IOPS=334.56 5.23 MiB/s (5.48 MB/s)
write: IOPS=223.03 3.48 MiB/s (3.65 MB/s)
fsync: IOPS=0.00
Latency (ms):
min: 0.18
avg: 42.99
max: 1329.63
95th percentile: 189.93
sum: 4320920.09
- 2.2.3 进行fileio(rndwr随机写)测试
[[email protected](252) /r2/soft/sysbench]# sysbench fileio --time=180 --events=100000000 --threads=24 --file-total-size=128G --file-test-mode=rndwr --file-num=128 --file-extra-flags=direct--file-fsync-freq=0 --file-block-size=16384 run
sysbench 1.1.0-0167e45 (using bundled LuaJIT 2.1.0-beta3)
Running the test with following options:
Number of threads: 24
Initializing random number generator from current time
Extra file open flags: 3
128 files, 1GiB each
128GiB total file size
Block size 16KiB
Number of IO requests: 100000000
Read/Write ratio for combined random IO test: 1.50
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing random write test
Initializing worker threads...
Threads started!
Throughput:
read: IOPS=0.00 0.00 MiB/s (0.00 MB/s)
write: IOPS=389.35 6.08 MiB/s (6.38 MB/s)
fsync: IOPS=0.00
Latency (ms):
min: 0.16
avg: 61.63
max: 1361.51
95th percentile: 108.68
sum: 4320453.91
- 2.2.4 进行fileio(rndrd随机读)测试
[[email protected](252) /r2/soft/sysbench]# sysbench fileio --time=180 --events=100000000 --threads=24 --file-total-size=128G --file-test-mode=rndrd --file-num=128 --file-extra-flags=direct--file-fsync-freq=0 --file-block-size=16384 run
sysbench 1.1.0-0167e45 (using bundled LuaJIT 2.1.0-beta3)
Running the test with following options:
Number of threads: 24
Initializing random number generator from current time
Extra file open flags: 3
128 files, 1GiB each
128GiB total file size
Block size 16KiB
Number of IO requests: 100000000
Read/Write ratio for combined random IO test: 1.50
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing random read test
Initializing worker threads...
Threads started!
Throughput:
read: IOPS=697.23 10.89 MiB/s (11.42 MB/s)
write: IOPS=0.00 0.00 MiB/s (0.00 MB/s)
fsync: IOPS=0.00
Latency (ms):
min: 0.41
avg: 34.41
max: 737.43
95th percentile: 114.72
sum: 4320295.10
2.3、 执行结果
- 分别进行rndrw(随机读写)、rndwr(随机写)、rndrd (随机读)各3分钟,如图R2目录(/dev/sdl)IOPS:
- rndrw(随机读写)平均读iops:334,平均写iops:223
- rndwr(随机写)平均写iops:389.35
- rndwr(随机读)平均读iops:697.23
2.4、 清除生成的数据
[[email protected](252) /r2/soft/sysbench]# sysbench --threads=24 --test=fileio --file-total-size=128G --file-test-mode=rndrw cleanup
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
sysbench 1.1.0-0167e45 (using bundled LuaJIT 2.1.0-beta3)
Removing test files...
以上是关于Sysbench 基准压测 IO篇的主要内容,如果未能解决你的问题,请参考以下文章