使用sysbench指定連接的時候不需要寫上mysql-socket參數
如果自己使用sysbench來測試mysql性能的話,建議使用源碼編譯比較好,版本為0.4版本。
步驟是:
1、yum install m4 autoconf automake libtool 2、./configure --prefix=/usr/local/sysbench --with-mysql-includes=/usr/local/mysql/include/ --with-mysql-libs=/usr/local/mysql/lib/ 3、make 4、make install
但是如果是測試tidb性能的,因為tidb官方推薦腳本,所以選擇yum安裝的sysbench比較好,這時安裝的sysbench是1.0版本的。
tidb的官方腳本:https://github.com/pingcap/tidb-bench/tree/cwen/not_prepared_statement/sysbench
直接在tidb提供的conf.sh文件里面把配置寫好,然后就可以執行那些需要的腳本了(比如prepare.sh、select.sh)
在AWS自己定制的實例上面,使用yum安裝sysbench1.0是不行的,原因是沒有yum源。所以警告一番折騰之后有了下面這個
curl -s https://packagecloud.io/install/repositories/akopytov/sysbench/script.rpm.sh | sudo bash sudo yum -y install sysbench
這個時候就可以安裝sysbench1.0了。
sysbench壓力測試結果說明
Threads started! OLTP test statistics: queries performed: read: 179470-- 讀總數 write: 453935-- 寫總數 other: 70678-- 其他操作總數(SELECT、INSERT、UPDATE、DELETE之外的操作,例如COMMIT等) total: 704083 -- 全部總數 transactions事務量: 34784 (347.32 per sec.)-- 總事務數(每秒事務數) queries 讀寫總操作: 633405 (6324.57 per sec.) -- 讀寫總數(每秒讀寫次數) other operations其他操作: 70678 (705.72 per sec.)-- 其他操作總數(每秒其他操作次數) ignored errors: 1110 (11.08 per sec.)-- 每秒忽略的錯誤 reconnects: 0 (0.00 per sec.)--每秒重連次數 General statistics: total time(總時長): 100.1499s -- 總耗時 total number of events: 34784 -- 共發生多少事務數 total time taken by events execution: 1996.2507s -- 所有事務耗時相加(不考慮並行因素) response time(相應時間): min最小: 2.54ms-- 最小耗時 avg平均: 57.39ms-- 平均耗時 max最大: 1074.85ms -- 最長耗時 95th percentile: 133.50ms-- 超過99%平均耗時 Threads fairness: events (avg/stddev): 1739.2000/35.03 execution time (avg/stddev): 99.8125/0.05
