這篇文章主要介紹了MySQL中壓測(cè)工具Sysbench1.0怎么用,具有一定借鑒價(jià)值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。
目前成都創(chuàng)新互聯(lián)已為上千的企業(yè)提供了網(wǎng)站建設(shè)、域名、網(wǎng)頁(yè)空間、網(wǎng)站托管維護(hù)、企業(yè)網(wǎng)站設(shè)計(jì)、巴中網(wǎng)站維護(hù)等服務(wù),公司將堅(jiān)持客戶導(dǎo)向、應(yīng)用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協(xié)力一起成長(zhǎng),共同發(fā)展。一、簡(jiǎn)介
Sysbench壓測(cè)工具常用版本有0.4(較舊),0.5(據(jù)說(shuō)非官方正宗開源版),1.0(最新的官方開源版本),不同版本之間的系統(tǒng)壓測(cè)差異較小。但對(duì)數(shù)據(jù)庫(kù)的壓測(cè)參數(shù)、結(jié)果具有較大差異,這里針對(duì)sysbench壓測(cè)MYSQL數(shù)據(jù)庫(kù)做下安裝、使用介紹。
二、壓測(cè)環(huán)境
硬件環(huán)境:
測(cè)試機(jī) | Dell PowerEdge R730xd |
CPU | Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz (2物理CPU,每個(gè)6核心,每個(gè)核心2線程,總共24processor) |
內(nèi)存 | 128G |
RAID卡 | PERC H730P Mini Memory Size : 2048MB |
raid級(jí)別 | Raid-5 |
文件系統(tǒng) | xfs |
硬盤 | 4T SAS * 12 |
軟件環(huán)境:
操作系統(tǒng) | Red Hat Enterprise Linux Server release 6.5 (Santiago) |
內(nèi)核 | 2.6.32-431.el6.x86_64 |
MYSQL版本 | 5.7.17 |
壓測(cè)工具 | sysbench 1.0.3 |
三、MYSQL核心參數(shù)
四、壓測(cè)模型
測(cè)試工具 | sysbench |
測(cè)試記錄數(shù) | 1,000,000 |
測(cè)試模式 | complex |
run time(秒) | 300 |
大請(qǐng)求數(shù) | 100,000 |
并發(fā)線程數(shù) | 1000 |
五、MYSQL壓測(cè)過(guò)程
以oltp_read_write.lua壓測(cè)為案例
1、sysbench2.0壓測(cè)工具安裝——請(qǐng)參照壓測(cè)工具之Sysbench(1_系統(tǒng)壓測(cè))
2、sysbench oltp壓測(cè)數(shù)據(jù)準(zhǔn)備
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
點(diǎn)擊(此處)折疊或打開
[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'...
2、sysbench oltp壓測(cè)開始
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
點(diǎn)擊(此處)折疊或打開
[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產(chǎn)生的壓測(cè)報(bào)告數(shù)據(jù)也與之前版本有較大差別
[ 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數(shù)量
write: 2000604 ##總update/insert/delete語(yǔ)句數(shù)量
other: 1001648 ##包含commit/unlock tables以及其他mutex語(yǔ)句
total: 10032870
transactions: 499461 (1662.65 per sec.) ##TPS
queries: 10032870 (33398.37 per sec.) ##QPS
ignored errors: 2726 (9.07 per sec.) ##忽略的錯(cuò)誤數(shù)
reconnects: 0 (0.00 per sec.)
General statistics:
total time: 300.3980s ##壓測(cè)總時(shí)間
total number of events: 499461 ##總事件數(shù)量,一般與transactions數(shù)值相同
Latency (ms):
min: 2.57
avg: 601.02 ##%95語(yǔ)句RT,平均響應(yīng)時(shí)間,單位是毫秒,可通過(guò)–percentile=100調(diào)節(jié)百分比
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
備注:需要重點(diǎn)關(guān)注的數(shù)據(jù)有執(zhí)行總時(shí)間、TPS:如果使用-skip-trx=on,這項(xiàng)事務(wù)數(shù)恒為0,需要用total number of events 去除以總時(shí)間,得到tps(其實(shí)還可以分為讀tps和寫tps),QPS和RT(平均響應(yīng)時(shí)間),以及系統(tǒng)壓測(cè)指標(biāo)CPU、內(nèi)存、IO等。
3、sysbench oltp壓測(cè)數(shù)據(jù)清理
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
點(diǎn)擊(此處)折疊或打開
[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'...
六、MYSQL壓測(cè)附錄
1、壓測(cè)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、其他重要參數(shù)
--histogram[=on|off] ##是否開啟生成直方圖,默認(rèn)是off
--percentile=N ##調(diào)整響應(yīng)時(shí)間的百分比,默認(rèn)是95
--events=N ##大的request數(shù)值,默認(rèn)是0,表示無(wú)大事件限制,別名是--max-requests=N
--db-driver=STRING ##數(shù)據(jù)庫(kù)驅(qū)動(dòng)mysql/oracle/pg
暫時(shí)簡(jiǎn)單的做下新版本的測(cè)試使用,后續(xù)完善壓測(cè)腳本、壓測(cè)結(jié)果整理...
感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享的“MySQL中壓測(cè)工具Sysbench1.0怎么用”這篇文章對(duì)大家有幫助,同時(shí)也希望大家多多支持創(chuàng)新互聯(lián),關(guān)注創(chuàng)新互聯(lián)-成都網(wǎng)站建設(shè)公司行業(yè)資訊頻道,更多相關(guān)知識(shí)等著你來(lái)學(xué)習(xí)!
網(wǎng)站標(biāo)題:MySQL中壓測(cè)工具Sysbench1.0怎么用-創(chuàng)新互聯(lián)
文章源于:http://m.rwnh.cn/article6/ddssog.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)網(wǎng)站建設(shè)、App設(shè)計(jì)、商城網(wǎng)站、做網(wǎng)站、用戶體驗(yàn)、網(wǎng)站設(shè)計(jì)公司
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容