1. 程式人生 > >Sysbench 基準壓測 IO篇

Sysbench 基準壓測 IO篇

pri start repo 3.1 分享 span mib initial cat

一、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

  • 標準安裝
[root@localhost-m
(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
[root@localhost-m(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隨機讀寫)測試
[root@localhost-m(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隨機寫)測試
[root@localhost-m(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隨機讀)測試
[root@localhost-m(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、 清除生成的數據

[root@localhost-m(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篇