壓測工具之Sysbench1.0(2_MySQL壓測)
Sysbench壓測工具常用版本有0.4(較舊),0.5(據說非官方正宗開源版),1.0(最新的官方開源版本),不同版本之間的系統壓測差異較小。但對資料庫的壓測引數、結果具有較大差異,這裡針對sysbench壓測MYSQL資料庫做下安裝、使用介紹。
二、壓測環境
硬體環境:
測試機 |
Dell PowerEdge R730xd |
CPU |
Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz (2物理CPU,每個6核心,每個核心2執行緒,總共24processor) |
記憶體 |
128G |
RAID卡 |
PERC H730P Mini Memory Size : 2048MB |
raid級別 |
Raid-5 |
檔案系統 |
xfs |
硬碟 |
4T SAS * 12 |
作業系統 |
Red Hat Enterprise Linux Server release 6.5 (Santiago) |
核心 |
2.6.32-431.el6.x86_64 |
MYSQL版本 |
5.7.17 |
壓測工具 |
sysbench 1.0.3 |
四、壓測模型
測試工具 |
sysbench |
測試記錄數 |
1,000,000 |
測試模式 |
complex |
run time(秒) |
300 |
最大請求數 |
100,000 |
併發執行緒數 |
1000 |
以oltp_read_write.lua壓測為案例
1、sysbench1.0壓測工具安裝——請參照壓測工具之Sysbench(1_系統壓測)
2、sysbench oltp壓測資料準備
sysbench /usr/local/sysbench/share/sysbench/oltp_read_write.lua --mysql-host=10.1.0.10 --mysql-port=3306 --mysql-user=dbuser --mysql-password=abc.1234 --mysql-db=dbtest --tables=10 --table-size=1000000 --report-interval=10 --threads=1000 --time=300 prepare
點選(此處)摺疊或開啟
-
[root@DB_TEST sysbench]# sysbench /usr/local/sysbench/share/sysbench/oltp_read_write.lua --mysql-host=10.1.0.10 --mysql-port=3306 --mysql-user=dbuser --mysql-password=abc.1234 --mysql-db=dbtest --tables=10 --table-size=1000000 --report-interval=10 --threads=1000 --time=300 prepare
-
sysbench 1.0.3 (using bundled LuaJIT 2.1.0-beta2)
-
-
Initializing worker threads...
-
-
Creating table 'sbtest7'...Creating table 'sbtest6'...
-
-
Creating table 'sbtest2'...
-
Creating table 'sbtest10'...
-
Creating table 'sbtest8'...
-
Creating table 'sbtest1'...
-
Creating table 'sbtest4'...
-
Creating table 'sbtest3'...
-
Creating table 'sbtest5'...
-
Creating table 'sbtest9'...
-
Inserting 1000000 records into 'sbtest3'
-
Inserting 1000000 records into 'sbtest8'
-
Inserting 1000000 records into 'sbtest2'
-
Inserting 1000000 records into 'sbtest6'
-
Inserting 1000000 records into 'sbtest10'
-
Inserting 1000000 records into 'sbtest7'
-
Inserting 1000000 records into 'sbtest1'
-
Inserting 1000000 records into 'sbtest5'
-
Inserting 1000000 records into 'sbtest9'
-
Inserting 1000000 records into 'sbtest4'
-
Creating a secondary index on 'sbtest1'...
-
Creating a secondary index on 'sbtest7'...
-
Creating a secondary index on 'sbtest5'...
-
Creating a secondary index on 'sbtest3'...
-
Creating a secondary index on 'sbtest4'...
-
Creating a secondary index on 'sbtest9'...
-
Creating a secondary index on 'sbtest6'...
-
Creating a secondary index on 'sbtest10'...
-
Creating a secondary index on 'sbtest2'...
- Creating a secondary index on 'sbtest8'...
sysbench /usr/local/sysbench/share/sysbench/oltp_read_write.lua --mysql-host=10.1.0.10 --mysql-port=3306 --mysql-user=dbuser --mysql-password=abc.1234 --mysql-db=dbtest --tables=10 --table-size=1000000 --report-interval=10 --threads=1000 --time=300 run
點選(此處)摺疊或開啟
-
[root@DB_TEST sysbench]# sysbench /usr/local/sysbench/share/sysbench/oltp_read_write.lua --mysql-host=10.1.0.10 --mysql-port=3306 --mysql-user=dbuser --mysql-password=abc.1234 --mysql-db=dbtest --tables=10 --table-size=1000000 --report-interval=10 --threads=1000 --time=300 run
-
sysbench 1.0.3 (using bundled LuaJIT 2.1.0-beta2)
-
-
Running the test with following options:
-
Number of threads: 1000
-
Report intermediate results every 10 second(s)
-
Initializing random number generator from current time
-
-
-
Initializing worker threads...
-
-
Threads started!
-
##下面每隔10S產生的壓測報告資料也與之前版本有較大差別
-
[ 10s ] thds: 1000 tps: 1290.73 qps: 27199.93 (r/w/o: 19259.14/5258.29/2682.51) lat (ms,95%): 2680.11 err/s: 1.30 reconn/s: 0.00
-
[ 20s ] thds: 1000 tps: 1291.33 qps: 25644.68 (r/w/o: 17913.30/5146.02/2585.36) lat (ms,95%): 2120.76 err/s: 2.70 reconn/s: 0.00
-
[ 30s ] thds: 1000 tps: 1749.09 qps: 34514.35 (r/w/o: 24078.49/6932.57/3503.28) lat (ms,95%): 1258.08 err/s: 5.10 reconn/s: 0.00
-
...
-
...
-
[ 280s ] thds: 1000 tps: 1608.70 qps: 32380.81 (r/w/o: 22645.91/6509.20/3225.70) lat (ms,95%): 2680.11 err/s: 8.30 reconn/s: 0.00
-
[ 290s ] thds: 1000 tps: 1441.71 qps: 28987.87 (r/w/o: 20274.92/5823.03/2889.92) lat (ms,95%): 1803.47 err/s: 6.50 reconn/s: 0.00
-
[ 300s ] thds: 1000 tps: 1794.92 qps: 36050.03 (r/w/o: 25318.80/7126.59/3604.64) lat (ms,95%): 3639.94 err/s: 14.80 reconn/s: 0.00
-
SQL statistics:
-
queries performed:
-
read: 7030618 ##總select數量
-
write: 2000604 ##總update/insert/delete語句數量
-
other: 1001648 ##包含commit/unlock tables以及其他mutex語句
-
total: 10032870
-
transactions: 499461 (1662.65 per sec.) ##TPS
-
queries: 10032870 (33398.37 per sec.) ##QPS
-
ignored errors: 2726 (9.07 per sec.) ##忽略的錯誤數
-
reconnects: 0 (0.00 per sec.)
-
-
General statistics:
-
total time: 300.3980s ##壓測總時間
-
total number of events: 499461 ##總事件數量,一般與transactions數值相同
-
-
Latency (ms):
-
min: 2.57
-
avg: 601.02 ##%95語句RT,平均響應時間,單位是毫秒,可透過–percentile=100調節百分比
-
max: 13302.01
-
95th percentile: 1739.68
-
sum: 300186288.55
-
-
Threads fairness:
-
events (avg/stddev): 499.4610/27.20
- execution time (avg/stddev): 300.1863/0.07
3、sysbench oltp壓測資料清理
sysbench /usr/local/sysbench/share/sysbench/oltp_read_write.lua --mysql-host=10.1.0.10 --mysql-port=3306 --mysql-user=dbuser --mysql-password=abc.1234 --mysql-db=dbtest --tables=10 --table-size=1000000 --report-interval=10 --threads=1000 --time=300 cleanup
點選(此處)摺疊或開啟
-
[root@DB_TEST sysbench]# sysbench /usr/local/sysbench/share/sysbench/oltp_read_write.lua --mysql-host=10.1.0.10 --mysql-port=3306 --mysql-user=dbuser --mysql-password=abc.1234 --mysql-db=dbtest --tables=10 --table-size=1000000 --report-interval=10 --threads=1000 --time=300 cleanup
-
sysbench 1.0.3 (using bundled LuaJIT 2.1.0-beta2)
-
-
Dropping table 'sbtest1'...
-
Dropping table 'sbtest2'...
-
Dropping table 'sbtest3'...
-
Dropping table 'sbtest4'...
-
Dropping table 'sbtest5'...
-
Dropping table 'sbtest6'...
-
Dropping table 'sbtest7'...
-
Dropping table 'sbtest8'...
-
Dropping table 'sbtest9'...
- Dropping table 'sbtest10'...
1、壓測lua指令碼
bulk_insert.lua
oltp_common.lua
oltp_delete.lua
oltp_insert.lua
oltp_point_select.lua
oltp_read_only.lua
oltp_read_write.lua
oltp_update_index.lua
oltp_update_non_index.lua
oltp_write_only.lua
select_random_points.lua
select_random_ranges.lua
2、其他重要引數
--histogram[=on|off] ##是否開啟生成直方圖,預設是off
--percentile=N ##調整響應時間的百分比,預設是95
--events=N ##最大的request數值,預設是0,表示無最大事件限制,別名是--max-requests=N
--db-driver=STRING ##資料庫驅動mysql/oracle/pg
暫時簡單的做下新版本的測試使用,後續完善壓測指令碼、壓測結果整理...
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27067062/viewspace-2135183/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 壓測工具之Sysbench(1_系統壓測)
- 【工具】MySQL 壓測工具之mydbtestMySql
- 壓力測試工具之FIO
- 壓力測試工具之mysqlslapMySql
- 壓測工具 wrk
- kafka壓測工具Kafka
- Nginx壓力測試工具之WebBenchNginxWeb
- apache ab壓力測試工具-批次壓測指令碼Apache指令碼
- Jmeter-壓測工具JMeter
- 壓力測試工具
- 效能壓測工具 —— wrk
- 壓測工具jemiter使用MIT
- 全鏈路壓測演進之迭代式壓測
- 壓縮工具效能測試
- [心得]Tsung壓測工具科普
- Webbench網站壓測工具Web網站
- 效能測試:主流壓測工具介紹
- jmeter之——jms壓測(activemq)JMeterMQ
- 壓測工具之JMeter之環境配置及執行JMeter
- NoSQLBench壓測工具入門教程SQL
- 網站壓力測試工具網站
- Mysql 壓力測試工具sysbenchMySql
- 效能工具之Jmeter壓測Thrift RPC服務JMeterRPC
- 效能工具之Jmeter壓測Hprose RPC服務JMeterROSRPC
- Go 效能壓測工具之wrk介紹與使用Go
- 很好用的壓測工具 - Apache Bench工具Apache
- mysql壓測MySql
- locust壓測
- 壓測流程
- oracle壓力測試之orastress!OracleAST
- 10大主流壓力測試工具
- CentOS 下安裝 wrk 壓測工具CentOS
- ELK esrally 壓測工具安裝使用
- 編寫一個介面壓測工具
- HTTP/FTP壓力測試工具siegeHTTPFTP
- Web網站壓力測試工具Web網站
- mysql之 mysql資料庫壓力測試工具(mysqlslap)MySql資料庫
- 超實用壓力測試工具-ab工具