mysql benchmark

https://github.com/akopytov/sysbench#linux

 

centos 安装

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

 

sysbench --help 查看帮助

git 下载sysbench项目

git clone git clone https://github.com/akopytov/sysbench.git

进入lua目录执行命令

cd /root/sysbench/src/lua

先执行prepare,再执行run

 

sysbench oltp_read_write.lua --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-db=test --mysql-user=root --mysql-password=**** --table_size=20000 --tables=1 --threads=500 --events=500000 --report-interval=10 --time=0 prepare

 

sysbench oltp_read_write.lua --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-db=test --mysql-user=root --mysql-password=**** --table_size=20000 --tables=1 --threads=500 --events=500000 --report-interval=10 --time=0 run

 

 

sysbench 1.0.17 (using system LuaJIT 2.0.4)

Running the test with following options:
Number of threads: 500
Report intermediate results every 10 second(s)
Initializing random number generator from current time


Initializing worker threads...

Threads started!

[ 10s ] thds: 500 tps: 220.72 qps: 8675.74 (r/w/o: 6781.34/1189.30/705.11) lat (ms,95%): 4768.67 err/s: 213.73 reconn/s: 0.00
[ 20s ] thds: 500 tps: 230.11 qps: 8242.49 (r/w/o: 6343.45/1215.83/683.22) lat (ms,95%): 5813.24 err/s: 223.01 reconn/s: 0.00
[ 30s ] thds: 500 tps: 227.50 qps: 8197.50 (r/w/o: 6316.90/1201.90/678.70) lat (ms,95%): 5813.24 err/s: 223.70 reconn/s: 0.00
[ 40s ] thds: 500 tps: 227.90 qps: 8303.40 (r/w/o: 6407.90/1209.90/685.60) lat (ms,95%): 5607.61 err/s: 229.80 reconn/s: 0.00
[ 50s ] thds: 500 tps: 197.60 qps: 7163.93 (r/w/o: 5523.95/1047.79/592.19) lat (ms,95%): 6135.91 err/s: 197.00 reconn/s: 0.00
[ 60s ] thds: 500 tps: 227.70 qps: 8030.90 (r/w/o: 6171.50/1190.90/668.50) lat (ms,95%): 6476.48 err/s: 213.10 reconn/s: 0.00
[ 70s ] thds: 500 tps: 231.10 qps: 8264.20 (r/w/o: 6357.50/1221.50/685.20) lat (ms,95%): 5813.24 err/s: 223.00 reconn/s: 0.00
[ 80s ] thds: 500 tps: 226.90 qps: 8227.47 (r/w/o: 6346.87/1200.09/680.50) lat (ms,95%): 5813.24 err/s: 226.70 reconn/s: 0.00
[ 90s ] thds: 500 tps: 224.70 qps: 8095.89 (r/w/o: 6240.57/1185.11/670.21) lat (ms,95%): 6247.39 err/s: 220.80 reconn/s: 0.00
[ 100s ] thds: 500 tps: 229.30 qps: 8285.59 (r/w/o: 6386.79/1213.30/685.50) lat (ms,95%): 5507.54 err/s: 226.90 reconn/s: 0.00
[ 110s ] thds: 500 tps: 220.40 qps: 8139.71 (r/w/o: 6290.33/1179.59/669.79) lat (ms,95%): 6247.39 err/s: 229.00 reconn/s: 0.00
[ 120s ] thds: 500 tps: 227.80 qps: 7980.25 (r/w/o: 6130.44/1184.21/665.60) lat (ms,95%): 6026.41 err/s: 210.00 reconn/s: 0.00
[ 130s ] thds: 500 tps: 229.30 qps: 8194.79 (r/w/o: 6306.40/1208.40/680.00) lat (ms,95%): 5813.24 err/s: 221.40 reconn/s: 0.00
[ 140s ] thds: 500 tps: 223.30 qps: 8173.31 (r/w/o: 6307.61/1192.10/673.60) lat (ms,95%): 5813.24 err/s: 227.00 reconn/s: 0.00
[ 150s ] thds: 500 tps: 227.00 qps: 8222.90 (r/w/o: 6340.40/1202.60/679.90) lat (ms,95%): 5709.50 err/s: 225.90 reconn/s: 0.00
[ 160s ] thds: 500 tps: 235.50 qps: 8556.37 (r/w/o: 6599.85/1249.61/706.91) lat (ms,95%): 5709.50 err/s: 235.90 reconn/s: 0.00

 

测试tidb的时候报错

报这个错,需要使用设置,防止回滚

set global tidb_disable_txn_auto_retry = off;

FATAL: mysql_stmt_execute() returned error 8005 (Write conflict, txnStartTS 410934752817185632 is stale [try again later]) for query 'COMMIT'
FATAL: `thread_run' function failed: ./oltp_common.lua:416: SQL error, errno = 8005, state = 'HY000': Write conflict, txnStartTS 410934752817185632 is stale [try again later]
FATAL: mysql_stmt_execute() returned error 8005 (Write conflict, txnStartTS 410934752817185611 is stale [try again later]) for query 'COMMIT'
FATAL: `thread_run' function failed: ./oltp_common.lua:416: SQL error, errno = 8005, state = 'HY000': Write conflict, txnStartTS 410934752817185611 is stale [try again later]
FATAL: mysql_stmt_execute() returned error 8005 (Write conflict, txnStartTS 410934752817185842 is stale [try again later]) for query 'COMMIT'
FATAL: `thread_run' function failed: ./oltp_common.lua:416: SQL error, errno = 8005, state = 'HY000': Write conflict, txnStartTS 410934752817185842 is stale [try again later]
FATAL: mysql_stmt_execute() returned error 8005 (Write conflict, txnStartTS 410934752817185654 is stale [try again later]) for query 'COMMIT'
FATAL: `thread_run' function failed: ./oltp_common.lua:416: SQL error, errno = 8005, state = 'HY000': Write conflict, txnStartTS 410934752817185654 is stale [try again later]
FATAL: mysql_stmt_execute() returned error 8005 (Write conflict, txnStartTS 410934752817185576 is stale [try again later]) for query 'COMMIT'
FATAL: `thread_run' function failed: ./oltp_common.lua:416: SQL error, errno = 8005, state = 'HY000': Write conflict, txnStartTS 410934752817185576 is stale [try again later]
FATAL: mysql_stmt_execute() returned error 8005 (Write conflict, txnStartTS 410934752817185566 is stale [try again later]) for query 'COMMIT'
FATAL: `thread_run' function failed: ./oltp_common.lua:416: SQL error, errno = 8005, state = 'HY000': Write conflict, txnStartTS 410934752817185566 is stale [try again later]
FATAL: mysql_stmt_execute() returned error 8005 (Write conflict, txnStartTS 410934752817185753 is stale [try again later]) for query 'COMMIT'
FATAL: `thread_run' function failed: ./oltp_common.lua:416: SQL error, errno = 8005, state = 'HY000': Write conflict, txnStartTS 410934752817185753 is stale [try again later]
FATAL: mysql_stmt_execute() returned error 8005 (Write conflict, txnStartTS 410934752817185789 is stale [try again later]) for query 'COMMIT'
FATAL: `thread_run' function failed: ./oltp_common.lua:416: SQL error, errno = 8005, state = 'HY000': Write conflict, txnStartTS 410934752817185789 is stale [try again later]
FATAL: mysql_stmt_execute() returned error 8005 (Write conflict, txnStartTS 410934752817185569 is stale [try again later]) for query 'COMMIT'
FATAL: `thread_run' function failed: ./oltp_common.lua:416: SQL error, errno = 8005, state = 'HY000': Write conflict, txnStartTS 410934752817185569 is stale [try again later]
FATAL: mysql_stmt_execute() returned error 8005 (Write conflict, txnStartTS 410934752817185585 is stale [try again later]) for query 'COMMIT'
FATAL: `thread_run' function failed: ./oltp_common.lua:416: SQL error, errno = 8005, state = 'HY000': Write conflict, txnStartTS 410934752817185585 is stale [try again later]
FATAL: mysql_stmt_execute() returned error 8005 (Write conflict, txnStartTS 410934752817185670 is stale [try again later]) for query 'COMMIT'
FATAL: `thread_run' function failed: ./oltp_common.lua:416: SQL error, errno = 8005, state = 'HY000': Write conflict, txnStartTS 410934752817185670 is stale [try again later]
FATAL: mysql_stmt_execute() returned error 8005 (Write conflict, txnStartTS 410934752817185616 is stale [try again later]) for query 'COMMIT'
FATAL: `thread_run' function failed: ./oltp_common.lua:416: SQL error, errno = 8005, state = 'HY000': Write conflict, txnStartTS 410934752817185616 is stale [try again later]
FATAL: mysql_stmt_execute() returned error 8005 (Write conflict, txnStartTS 410934752817185613 is stale [try again later]) for query 'COMMIT'
FATAL: `thread_run' function failed: ./oltp_common.lua:416: SQL error, errno = 8005, state = 'HY000': Write conflict, txnStartTS 410934752817185613 is stale [try again later]
FATAL: mysql_stmt_execute() returned error 8005 (Write conflict, txnStartTS 410934752817185595 is stale [try again later]) for query 'COMMIT'

你可能感兴趣的:(各种问题)