這篇文章主要介紹“MySQL sysben0.5的安裝和測(cè)試步驟”,在日常操作中,相信很多人在mysql sysben0.5的安裝和測(cè)試步驟問題上存在疑惑,小編查閱了各式資料,整理出簡(jiǎn)單好用的操作方法,希望對(duì)大家解答”mysql sysben0.5的安裝和測(cè)試步驟”的疑惑有所幫助!接下來(lái),請(qǐng)跟著小編一起來(lái)學(xué)習(xí)吧!
從策劃到設(shè)計(jì)制作,每一步都追求做到細(xì)膩,制作可持續(xù)發(fā)展的企業(yè)網(wǎng)站。為客戶提供成都網(wǎng)站設(shè)計(jì)、成都網(wǎng)站制作、網(wǎng)站策劃、網(wǎng)頁(yè)設(shè)計(jì)、申請(qǐng)域名、雅安服務(wù)器托管、網(wǎng)絡(luò)營(yíng)銷、VI設(shè)計(jì)、 網(wǎng)站改版、漏洞修補(bǔ)等服務(wù)。為客戶提供更好的一站式互聯(lián)網(wǎng)解決方案,以客戶的口碑塑造優(yōu)易品牌,攜手廣大客戶,共同發(fā)展進(jìn)步。
安裝sysbench
OS readhat 6.4
mysql版本5.7
mysql安裝目錄
下載安裝包 https://github.com/akopytov/sysbench
shell> wget https://github.com/akopytov/sysbench/archive/1.0.zip -O "sysbench-1.0.zip"
2. 安裝依賴包
# yum -y install make automake libtool pkgconfig libaio-devel vim-common
3、上傳到linux系統(tǒng)中(/usr/local/),并且解壓,進(jìn)入/usr/local/執(zhí)行:
p unzip sysbench-0.5.zip -d /usr/local
4、創(chuàng)建sysbench安裝目錄文件夾:
5、進(jìn)入/usr/local/sysbench-master/執(zhí)行:./autogen.sh
# cd /usr/local/sysbench-0.5
# ./autogen.sh
6.
#./configure --prefix=/usr/local/sysbench-0.5 --with-mysql-includes=/usr/local/mysql/include --with-mysql-libs=/usr/local/mysql/lib/;
7.
# make
8.
# make install
9.查看版本
[root@msyqlzhu sysbench-0.5]# /usr/local/sysbench-0.5/bin/sysbench version
sysbench 0.5
如果出現(xiàn):(sysbench: error while loading shared libraries: libmysqlclient.so.20: cannot open shared object file: No such file or directory)報(bào)錯(cuò),
則在(vim /etc/profile 中加入:export LD_LIBRARY_PATH=/usr/local/mysql/lib/)
常用參數(shù):
#-test=tests/db/oltp.lua 表示調(diào)用 tests/db/oltp.lua 腳本進(jìn)行 oltp 模式測(cè)試
#--oltp_tables_count=10 表示會(huì)生成 10 個(gè)測(cè)試表
#--oltp-table-size=100000 表示每個(gè)測(cè)試表填充數(shù)據(jù)量為 100000
#--rand-init=on 表示每個(gè)測(cè)試表都是用隨機(jī)數(shù)據(jù)來(lái)填充的
#-num-threads=8 表示發(fā)起 8個(gè)并發(fā)連接
#--oltp-read-表示不要進(jìn)行只讀測(cè)試,也就是會(huì)采用讀寫混合模式測(cè)試
#--report-interval=10 表示每10秒輸出一次測(cè)試進(jìn)度報(bào)告
#--rand-type=uniform 表示隨機(jī)類型為固定模式,其他幾個(gè)可選隨機(jī)模式:uniform(固定),gaussian(高斯),special(特定的),pareto(帕累托)
#--max-time=120 表示最大執(zhí)行時(shí)長(zhǎng)為 120秒
#--max-requests=0 表示總請(qǐng)求數(shù)為 0,因?yàn)樯厦嬉呀?jīng)定義了總執(zhí)行時(shí)長(zhǎng),所以總請(qǐng)求數(shù)可以設(shè)定為 0;也可以只設(shè)定總請(qǐng)求數(shù),不設(shè)定最大執(zhí)行時(shí)長(zhǎng)
#--percentile=99 表示設(shè)定采樣比例,默認(rèn)是 95%,即丟棄1%的長(zhǎng)請(qǐng)求,在剩余的99%里取最大值
測(cè)試文件IO
測(cè)試cpu的CPU測(cè)試使用64位整數(shù),測(cè)試計(jì)算素?cái)?shù)直到某個(gè)最大值所需要的時(shí)間。
# /usr/local/sysbench-0.5/bin/sysbench --test=cpu --cpu-max-prime=20000 run
General statistics:
total time: 26.8631s
total number of events: 10000
total time taken by event execution: 26.8434s
response time:
min: 2.24ms
avg: 2.68ms
max: 7.49ms
approx. 95 percentile: 3.20ms
Threads fairness:
events (avg/stddev): 10000.0000/0.00
execution time (avg/stddev): 26.8434/0.00
1.測(cè)試線程
[root@msyqlzhu t]# /usr/local/sysbench-0.5/bin/sysbench --test=threads --num-threads=64 run
sysbench 0.5: multi-threaded system evaluation benchmark
Running the test with following options:
Number of threads: 64
Random number generator seed is 0 and will be ignored
Initializing worker threads...
Threads started!
General statistics:
total time: 5.2132s
total number of events: 10000
total time taken by event execution: 332.6492s
response time:
min: 0.23ms
avg: 33.26ms
max: 282.98ms
approx. 95 percentile: 87.66ms
Threads fairness:
events (avg/stddev): 156.2500/5.53
execution time (avg/stddev): 5.1976/0.01
2.互斥鎖測(cè)試互斥鎖(mutex)
/usr/local/sysbench-0.5/bin/sysbench --test=mutex --num-threads=16 --mutex-num=2048 --mutex-locks=1000000 --mutex-loops=5000 run
sysbench 0.5: multi-threaded system evaluation benchmark
Running the test with following options:
Number of threads: 16
Random number generator seed is 0 and will be ignored
Initializing worker threads...
Threads started!
General statistics:
total time: 2.5536s
total number of events: 16
total time taken by event execution: 39.6446s
response time:
min: 2348.59ms
avg: 2477.79ms
max: 2553.24ms
approx. 95 percentile: 2549.79ms
Threads fairness:
events (avg/stddev): 1.0000/0.00
execution time (avg/stddev): 2.4778/0.07
3.內(nèi)存測(cè)試
[root@msyqlzhu ~]# /usr/local/sysbench-0.5/bin/sysbench --test=memory --memory-block-size=8K --memory-total-size=1G --num-threads=16 run
4. 文件IO基準(zhǔn)測(cè)試
共1G
[root@msyqlzhu ~]# /usr/local/sysbench-0.5/bin/sysbench --test=fileio --file-total-size=1G prepare
1073741824 bytes written in 8.15 seconds (125.60 MB/sec).
測(cè)試文件IO 4個(gè)文件共4G
[root@msyqlzhu ~]# /usr/local/sysbench-0.5/bin/sysbench --test=fileio --file-num=4 --file-total-size=4G prepare
4261412864 bytes written in 6.52 seconds (623.68 MB/sec).
測(cè)試文件IO 4個(gè)文件共4G.塊大小為16K
[root@msyqlzhu ~]# /usr/local/sysbench-0.5/bin/sysbench --test=fileio --file-num=4 --file-block-size=16384 --file-total-size=4G prepare
這個(gè)命令會(huì)在當(dāng)前工作目錄下創(chuàng)建測(cè)試文件,后續(xù)的運(yùn)行(run)階段將通過(guò)讀寫這些文件進(jìn)行測(cè)試。 第二步就是運(yùn)行(run)階段,針對(duì)不同的IO 類型有不同的測(cè)試選項(xiàng):
seqwr 順序?qū)懭?/p>
seqrewr 順序重寫
seqrd 順序讀取
rndrd 隨機(jī)讀取
rndwr 隨機(jī)寫入
rndrw 混合隨機(jī)讀/寫
下面的命令運(yùn)行文件I/O混合隨機(jī)讀/寫基準(zhǔn)測(cè)試:
混合隨機(jī)讀/寫
/usr/local/sysbench-0.5/bin/sysbench --test=fileio --file-total-size=4G --file-test-mode=rndrw --init-rng=on --max-time=300 --max-requests=0 run
清除測(cè)試的文件
/usr/local/sysbench-0.5/bin/sysbench --test=fileio --fil-total-size=30G cleanup
測(cè)試oltp
1.找到select.lua腳本路徑
[root@msyqlzhu t]# find / -name oltp.lua
/usr/local/sysbench-0.5/sysbench/tests/db/oltp.lua
2.創(chuàng)建測(cè)試的時(shí)候默認(rèn)用sbtest庫(kù)
> create database sbtest;
3.prepare生成數(shù)據(jù)和表
使用的參數(shù)
--oltp-table-size 生成的表的記錄數(shù)
--oltp-tables-count生成的表的個(gè)數(shù)
# /usr/local/sysbench-0.5/bin/sysbench --test=/usr/local/sysbench-0.5/sysbench/tests/db/oltp.lua --oltp-table-size=100000 --mysql-user=root --oltp-tables-count=10 --mysql-password=ORACLE --mysql-socket=/mysqldata/mysql/data/mysql.sock prepare
4.run運(yùn)行
也可使用parallel_prepare.lua腳本并行準(zhǔn)備測(cè)試數(shù)據(jù),
運(yùn)行時(shí)使用的參數(shù)
--oltp-dist-pct 熱點(diǎn)數(shù)據(jù)的比例
--oltp-dist-res 熱點(diǎn)數(shù)據(jù)訪問頻率
--num-threads 線程數(shù)
--max-time=3000 執(zhí)行時(shí)間
--report-interval 打印報(bào)告的時(shí)間間隔
# /usr/local/sysbench-0.5/bin/sysbench --test=/usr/local/sysbench-0.5/sysbench/tests/db/oltp.lua --num-threads=20 --oltp-dist-pct=1 --oltp-dist-res=75 --oltp-table-size=100000 --num-threads=100 --mysql-db=sbtest --mysql-user=root --oltp-tables-count=10 --max-time=3000 --max-requests=0 --report-interval=3 --mysql-password=ORACLE --mysql-socket=/mysqldata/mysql/data/mysql.sock run
生成的報(bào)告,tps:約為495,響應(yīng)時(shí)間response time約為380毫秒,qps約為6千多
[ 141s] threads: 100, tps: 481.38, reads: 6728.28, writes: 2001.18, response time: 369.82ms (95%), errors: 0.33, reconnects: 0.00
[ 144s] threads: 100, tps: 495.94, reads: 6958.09, writes: 1970.41, response time: 339.89ms (95%), errors: 0.00, reconnects: 0.00
[ 147s] threads: 100, tps: 513.72, reads: 7193.10, writes: 2076.22, response time: 326.33ms (95%), errors: 0.33, reconnects: 0.00
[ 150s] threads: 100, tps: 494.33, reads: 6921.66, writes: 1971.33, response time: 333.44ms (95%), errors: 0.33, reconnects: 0.00
[ 153s] threads: 100, tps: 441.32, reads: 6032.87, writes: 1685.30, response time: 396.06ms (95%), errors: 0.00, reconnects: 0.00
[ 156s] threads: 100, tps: 502.62, reads: 7007.69, writes: 2000.82, response time: 398.92ms (95%), errors: 0.00, reconnects: 0.00
[ 159s] threads: 100, tps: 428.68, reads: 6192.48, writes: 1805.71, response time: 365.53ms (95%), errors: 0.00, reconnects: 0.00
[ 162s] threads: 100, tps: 438.70, reads: 6140.14, writes: 1777.47, response time: 586.58ms (95%), errors: 0.33, reconnects: 0.00
[ 165s] threads: 100, tps: 495.63, reads: 6928.11, writes: 1951.51, response time: 380.04ms (95%), errors: 0.00, reconnects: 0.00
5.clearnup
# /usr/local/sysbench-0.5/bin/sysbench --test=/usr/local/sysbench-0.5/sysbench/tests/db/oltp.lua --oltp-table-size=100000 --mysql-db=sbtest --mysql-user=root --oltp-tables-count=10 --mysql-password=ORACLE --mysql-socket=/mysqldata/mysql/data/mysql.sock cleanup
測(cè)試select
1.prepare生成數(shù)據(jù)
# /usr/local/sysbench-0.5/bin/sysbench --test=/usr/local/sysbench-0.5/sysbench/tests/db/select.lua --oltp-table-size=10000000 --mysql-user=root --oltp-tables-count=10 --mysql-password=ORACLE --mysql-socket=/mysqldata/mysql/data/mysql.sock prepare
2.run運(yùn)行
運(yùn)行時(shí)使用的參數(shù)
--oltp-dist-pct 熱點(diǎn)數(shù)據(jù)的比例
--oltp-dist-res 熱點(diǎn)數(shù)據(jù)訪問頻率
--num-threads 線程數(shù)
--max-time=3000 執(zhí)行時(shí)間
--report-interval 打印報(bào)告的時(shí)間間隔
打印的報(bào)告種的reads表示qps,response time表示響應(yīng)時(shí)間
# /usr/local/sysbench-0.5/bin/sysbench --test=/usr/local/sysbench-0.5/sysbench/tests/db/select.lua --num-threads=20 --oltp-dist-pct=1 --oltp-dist-res=75 --oltp-table-size=100000 --num-threads=10 --mysql-db=sbtest --mysql-user=root --oltp-tables-count=10 --max-time=3000 --max-requests=0 --report-interval=3 --mysql-password=ORACLE --mysql-socket=/mysqldata/mysql/data/mysql.sock run
[ 84s] threads: 100, tps: 0.00, reads: 22529.11, writes: 0.00, response time: 0.14ms (95%), errors: 0.00, reconnects: 0.00
[ 87s] threads: 100, tps: 0.00, reads: 22455.45, writes: 0.00, response time: 0.14ms (95%), errors: 0.00, reconnects: 0.00
[ 90s] threads: 100, tps: 0.00, reads: 22569.36, writes: 0.00, response time: 0.13ms (95%), errors: 0.00, reconnects: 0.00
[ 93s] threads: 100, tps: 0.00, reads: 21957.72, writes: 0.00, response time: 0.15ms (95%), errors: 0.00, reconnects: 0.00
[ 96s] threads: 100, tps: 0.00, reads: 21588.06, writes: 0.00, response time: 0.14ms (95%), errors: 0.00, reconnects: 0.00
cleanup
# /usr/local/sysbench-0.5/bin/sysbench --test=/usr/local/sysbench-0.5/sysbench/tests/db/select.lua --oltp-dist-pct=1 --oltp-dist-res=75 --oltp-table-size=100000 --num-threads=10 --mysql-db=sbtest --mysql-user=root --oltp-tables-count=10 --mysql-password=ORACLE --mysql-socket=/mysqldata/mysql/data/mysql.sock cleanup
常用參數(shù):
Run的時(shí)候常用的參數(shù)
–oltp-tables-count
–oltp-read-only 僅執(zhí)行SELECT測(cè)試 on | off,默認(rèn)為off
–oltp-dist-type 隨機(jī)數(shù)分布狀態(tài)。uniform(均勻分布)、gauss(高斯分布)、special(特殊分布)
–oltp-dist-pct 特殊分布的百分比值
–oltp-dist-res 特殊分布的百分比
–oltp-point-selects 單個(gè)事務(wù)中指定的selec查詢個(gè)數(shù)
–oltp-range-size 范圍查詢的范圍大小,該值應(yīng)比oltp-table-size小
–oltp-simple-ranges 單個(gè)事務(wù)中指定的簡(jiǎn)單范圍查詢個(gè)數(shù)
–oltp-sum-ranges 單個(gè)事務(wù)中指定的SUM范圍查詢個(gè)數(shù)
–oltp-order-ranges 單個(gè)事務(wù)中指定的ORDER范圍查詢個(gè)數(shù)
–oltp-distinct-ranges 單個(gè)事務(wù)中指定的DISTINCT范圍查詢個(gè)數(shù)
–oltp-index-updates 單個(gè)事務(wù)中指定的使用索引更新的個(gè)數(shù)
–oltp-non-index-updates 單個(gè)事務(wù)中指定的不使用索引更新的個(gè)數(shù)
到此,關(guān)于“mysql sysben0.5的安裝和測(cè)試步驟”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識(shí),請(qǐng)繼續(xù)關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編會(huì)繼續(xù)努力為大家?guī)?lái)更多實(shí)用的文章!
新聞名稱:mysqlsysben0.5的安裝和測(cè)試步驟
網(wǎng)站URL:http://muchs.cn/article20/gjspjo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供用戶體驗(yàn)、外貿(mào)建站、電子商務(wù)、企業(yè)網(wǎng)站制作、營(yíng)銷型網(wǎng)站建設(shè)、微信公眾號(hào)
聲明:本網(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)