sysbench-初体验

因为想尝试一下 TIDB,那么用了sysbench来做压测。

1.安装两种方式。个人的操作是通过aptitude来安装。

curl -s https://packagecloud.io/install/repositories/akopytov/sysbench/script.deb.sh | sudo bash
sudo apt -y install sysbench

2.测试一下是否OK 。
root@hzxs-datanode-81:~ # sysbench -help
Unknown command: -help.
Usage:
sysbench [general-options]… –test=<test-name> [test-options]… command

General options:
–num-threads=N number of threads to use [1]
–max-requests=N limit for total number of requests [10000]
–max-time=N limit for total execution time in seconds [0]
–forced-shutdown=STRING amount of time to wait after –max-time before forcing shutdown [off]
–thread-stack-size=SIZE size of stack per thread [32K]
–init-rng=[on|off] initialize random number generator [off]
–test=STRING test to run
–debug=[on|off] print more debugging info [off]
–validate=[on|off] perform validation checks where possible [off]
–help=[on|off] print help and exit
–version=[on|off] print version and exit

Compiled-in tests:
fileio – File I/O test
cpu – CPU performance test
memory – Memory functions speed test
threads – Threads subsystem performance test
mutex – Mutex performance test
oltp – OLTP test

Commands: prepare run cleanup help version

See ‘sysbench –test=<name> help’ for a list of options for each test.

3.下载测试的脚本
wget https://github.com/akopytov/sysbench/archive/1.0.15.zip -O “sysbench-1.0.15.zip”
unzip sysbench-1.0.15.zip

4.准备数据
sysbench ./tests/include/oltp_legacy/oltp.lua –mysql-db=p_test –mysql-host=172.19.100.20 –mysql-port=4000 –mysql-user=p_test –mysql-password=123456 –oltp-test-mode=complex –oltp-tables-count=10 –oltp-table-size=100000 –threads=10 –time=120 –report-interval=10 prepare

5.压测数据
sysbench ./tests/include/oltp_legacy/oltp.lua –mysql-db=p_test –mysql-host=172.19.100.20 –mysql-port=4000 –mysql-user=p_test –mysql-password=123456 –oltp-test-mode=complex –oltp-tables-count=10 –oltp-table-size=100000 –threads=500 –time=500 –report-interval=10 run | tee /tmp/mysysbench.log

6.结果报告
Threads started!

[ 10s ] thds: 1000 tps: 1669.21 qps: 34651.70 (r/w/o: 24416.49/6796.81/3438.40) lat (ms,95%): 1506.29 err/s: 0.00 reconn/s: 0.00
[ 20s ] thds: 1000 tps: 1650.85 qps: 32979.66 (r/w/o: 23109.37/6568.59/3301.70) lat (ms,95%): 1561.52 err/s: 0.00 reconn/s: 0.00
[ 30s ] thds: 1000 tps: 1627.20 qps: 32518.92 (r/w/o: 22756.64/6507.98/3254.29) lat (ms,95%): 1648.20 err/s: 0.00 reconn/s: 0.00
[ 40s ] thds: 1000 tps: 1669.50 qps: 33442.26 (r/w/o: 23409.15/6694.11/3339.01) lat (ms,95%): 1561.52 err/s: 0.00 reconn/s: 0.00
[ 50s ] thds: 1000 tps: 1643.40 qps: 32689.60 (r/w/o: 22873.03/6529.68/3286.89) lat (ms,95%): 1589.90 err/s: 0.00 reconn/s: 0.00
[ 60s ] thds: 1000 tps: 1607.40 qps: 32274.78 (r/w/o: 22598.36/6461.62/3214.81) lat (ms,95%): 1618.78 err/s: 0.00 reconn/s: 0.00
[ 70s ] thds: 1000 tps: 2269.09 qps: 45334.35 (r/w/o: 31754.22/9042.65/4537.47) lat (ms,95%): 1376.60 err/s: 0.00 reconn/s: 0.00
[ 80s ] thds: 1000 tps: 3602.11 qps: 72061.91 (r/w/o: 50446.25/14410.84/7204.82) lat (ms,95%): 877.61 err/s: 0.00 reconn/s: 0.00
[ 90s ] thds: 1000 tps: 3560.80 qps: 71229.19 (r/w/o: 49847.29/14260.60/7121.30) lat (ms,95%): 831.46 err/s: 0.00 reconn/s: 0.00
[ 100s ] thds: 1000 tps: 3034.30 qps: 60757.01 (r/w/o: 42523.01/12165.10/6068.90) lat (ms,95%): 1213.57 err/s: 0.00 reconn/s: 0.00
[ 110s ] thds: 1000 tps: 3012.40 qps: 60200.85 (r/w/o: 42126.24/12051.21/6023.41) lat (ms,95%): 1235.62 err/s: 0.00 reconn/s: 0.00

7.清理数据
sysbench ./tests/include/oltp_legacy/oltp.lua –mysql-db=p_test –mysql-host=172.19.100.20 –mysql-port=4000 –mysql-user=p_test –mysql-password=123456 –oltp-test-mode=complex –oltp-tables-count=10 –oltp-table-size=100000 cleanup

发表评论?

0 条评论。

发表评论


注意 - 你可以用以下 HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>