一、安装
略
二、环境
在DBA的工具机上243.96
路径
# sysbench命令
/usr/bin/sysbench
# 各种测试工具路径
/usr/share/sysbench
三、测试数据
# sysbench创建测试用的表
/usr/bin/sysbench --mysql-host=172.21.27.30 \
--mysql-port=3306 \
--mysql-user=root \
--mysql-password=123 \
--mysql-db=sysbench \
--report-interval=1 \
/usr/share/sysbench/oltp_common.lua \
--tables=10 \
--table_size=1000000 \
prepare
#
cleanup
四、压测操作
# 混合读写(OLTP)
/usr/bin/sysbench oltp_read_write.lua --time=${timerun} --threads=${threadnum} --table-size=${table_size} --tables=${tablenum} --forced-shutdown=off --report-interval=1 --events=0 --mysql-user=${user} --mysql-password="${pass}" --mysql-host=$host --mysql-port=$port --mysql-db=${db} run
# 写测试
/usr/bin/sysbench oltp_write_only.lua --time=${timerun} --threads=${threadnum} --table-size=${table_size} --tables=${tablenum} --forced-shutdown=off --report-interval=1 --events=0 --mysql-user=${user} --mysql-pa
# 混合读写(OLTP)
../sysbench oltp_read_write.lua --time=${timerun} --threads=${threadnum} --table-size=${table_size} --tables=${tablenum} --forced-shutdown=off --report-interval=1 --events=0 --mysql-user=${user} --mysql-password="${pass}" --mysql-host=$host --mysql-port=$port --mysql-db=${db} run
# 写测试
../sysbench oltp_write_only.lua --time=${timerun} --threads=${threadnum} --table-size=${table_size} --tables=${tablenum} --forced-shutdown=off --report-interval=1 --events=0 --mysql-user=${user} --mysql-password="${pass}" --mysql-host=$host --mysql-port=$port --mysql-db=${db} run
# 只读测试
[root@KSSYYVI01352 sysbench]# /usr/bin/sysbench oltp_read_only.lua --time=10 --threads=10 --table-size=100000 --tables=10 --forced-shutdown=off --report-interval=1 --events=0 --mysql-user=root --mysql-password=123 --mysql-host=172.21.27.30 --mysql-port=3306 --mysql-db=sysbench run
sysbench 1.0.19 (using bundled LuaJIT 2.1.0-beta2)
Running the test with following options:
Number of threads: 10
Report intermediate results every 1 second(s)
Initializing random number generator from current time
Initializing worker threads...
Threads started!
[ 1s ] thds: 10 tps: 401.06 qps: 6514.68 (r/w/o: 5703.59/0.00/811.09) lat (ms,95%): 25.74 err/s: 0.00 reconn/s: 0.00
[ 2s ] thds: 10 tps: 414.11 qps: 6583.74 (r/w/o: 5756.52/0.00/827.22) lat (ms,95%): 24.83 err/s: 0.00 reconn/s: 0.00
[ 3s ] thds: 10 tps: 409.05 qps: 6554.86 (r/w/o: 5734.75/0.00/820.11) lat (ms,95%): 25.28 err/s: 0.00 reconn/s: 0.00
[ 4s ] thds: 10 tps: 406.95 qps: 6517.25 (r/w/o: 5704.35/0.00/812.91) lat (ms,95%): 25.28 err/s: 0.00 reconn/s: 0.00
[ 5s ] thds: 10 tps: 406.04 qps: 6528.71 (r/w/o: 5715.62/0.00/813.09) lat (ms,95%): 25.28 err/s: 0.00 reconn/s: 0.00
[ 6s ] thds: 10 tps: 408.96 qps: 6525.38 (r/w/o: 5707.45/0.00/817.92) lat (ms,95%): 25.28 err/s: 0.00 reconn/s: 0.00
[ 7s ] thds: 10 tps: 408.95 qps: 6500.28 (r/w/o: 5683.37/0.00/816.91) lat (ms,95%): 25.28 err/s: 0.00 reconn/s: 0.00
[ 8s ] thds: 10 tps: 404.06 qps: 6511.92 (r/w/o: 5702.81/0.00/809.11) lat (ms,95%): 25.28 err/s: 0.00 reconn/s: 0.00
[ 9s ] thds: 10 tps: 410.03 qps: 6524.41 (r/w/o: 5704.36/0.00/820.05) lat (ms,95%): 24.83 err/s: 0.00 reconn/s: 0.00
[ 10s ] thds: 10 tps: 405.95 qps: 6521.25 (r/w/o: 5711.35/0.00/809.91) lat (ms,95%): 24.83 err/s: 0.00 reconn/s: 0.00
SQL statistics:
queries performed:
read: 57204
write: 0
other: 8172
total: 65376
transactions: 4086 (407.47 per sec.)
queries: 65376 (6519.45 per sec.)
ignored errors: 0 (0.00 per sec.)
reconnects: 0 (0.00 per sec.)
General statistics:
total time: 10.0257s
total number of events: 4086
Latency (ms):
min: 23.35
avg: 24.50
max: 27.67
95th percentile: 25.28
sum: 100103.98
Threads fairness:
events (avg/stddev): 408.6000/3.01
execution time (avg/stddev): 10.0104/0.01