1 下載sysbench-0.5.tar.gz
下載地址 http://download.csdn.net/download/rcbblgy/7578433
2 執(zhí)行如下命令
tar xzvf sysbench-0.5.tar.gz
./configure --with-mysql --with-mysql-includes=/usr/local/mysql/include --with-mysql-libs=/usr/local/mysql/lib
3 查詢sysbench是否正確安裝 sysbench -v
4 常用的參數(shù)列表
--mysql-host=test.mysql.rds.aliyuncs.com #數(shù)據(jù)庫host
--mysql-port=3306 #數(shù)據(jù)庫端口 --mysql-user=your_username #數(shù)據(jù)庫用戶名 --mysql-password=your_password #數(shù)據(jù)庫密碼 --mysql-db=your_db_for_test #數(shù)據(jù)庫名 --oltp-tables-count=10 #模擬的表的個數(shù),規(guī)格越高該值越大 --oltp-table-size=6000000 #模擬的每張表的行數(shù),規(guī)格越高該值越大 --num-threads=50 #模擬的并發(fā)數(shù)量,規(guī)格越高該值越大 --max-requests=100000000 #最大請求次數(shù) --max-time=20 #最大測試時間(與--max-requests只要有一個超過,則退出) --report-interval=1 #每1秒打印一次當(dāng)前的QPS等值 --test=/tmp/sysbench-0.5/sysbench/tests/db/oltp.lua #選用的測試腳本(lua),此腳本可以從sysbench-0.5源代碼文件目錄下找 [prepare | run | cleanup] #prepare準(zhǔn)備數(shù)據(jù),run執(zhí)行測試,cleanup清理數(shù)據(jù)
5 準(zhǔn)備數(shù)據(jù)
[root@iZ254t8pd33Z ~]# sysbench --mysql-host=yongche1.mysql.rds.aliyuncs.com --mysql-port=3306 --mysql-user=jiangjianjian --mysql-password=pansino --mysql-db=yongche1 --oltp-tables-count=10 --oltp-table-size=6000000 --num-threads=50 --max-requests=100000000 --report-interval=1 --test=/root/sysbench-0.5/sysbench/tests/db/oltp.lua prepare
6 進(jìn)行測試及結(jié)果分析
oltp進(jìn)行壓測
[root@iZ254t8pd33Z ~]# sysbench --mysql-host=yongche1.mysql.rds.aliyuncs.com --mysql-port=3306 --mysql-user=jiangjianjian --mysql-password=pansino --mysql-db=yongche1 --oltp-tables-count=10 --oltp-table-size=6000000 --num-threads=50 --max-requests=100000000 --report-interval=1 --max-time=20 --test=/root/sysbench-0.5/sysbench/tests/db/oltp.lua run

分析壓測結(jié)果 TPS是平均每秒鐘事務(wù)提交次數(shù),QPS表示每秒查詢次數(shù)(包括read和write) oltp 讀寫比大概5300:1500
純insert情況 [root@iZ254t8pd33Z ~]# sysbench --mysql-host=yongche1.mysql.rds.aliyuncs.com --mysql-port=3306 --mysql-user=jiangjianjian --mysql-password=pansino --mysql-db=yongche1 --oltp-tables-count=10 --oltp-table-size=6000000 --num-threads=50 --max-requests=100000000 --report-interval=1 --max-time=20 --test=/root/sysbench-0.5/sysbench/tests/db/insert.lua run
結(jié)果分析:每秒寫入大概是4000條
內(nèi)存測試 sysbench --test=fileio --num-threads=16 --file-total-size=3G --file-test-mode=rndrw prepare
sysbench --test=memory --memory-block-size=8192 --memory-total-size=4G run
傳輸4G內(nèi)容,每個block 8k,速度大概每秒6093M
磁盤IO測試 sysbench --test=fileio --num-threads=16 --file-total-size=3G --file-test-mode=rndrw prepare
sysbench --test=fileio --num-threads=16 --file-total-size=3G --file-test-mode=rndrw run

指定了最大創(chuàng)建16個線程,創(chuàng)建的文檔總大小為3G,文檔讀寫模式為隨機(jī)讀,磁盤隨機(jī)讀寫速度大概為38M/s
CPU測試 sysbench --test=cpu --num-threads=32 --cpu-max-prime=90000 run
32個線程,尋找90000以內(nèi)的最大素數(shù)花了80s
PS 硬件條件 阿里云RDS 內(nèi)存大小: 24000M 最大IOPS: 12000
數(shù)據(jù)庫類型:MySQL5.6 最大連接數(shù):2000
聲明:本網(wǎng)頁內(nèi)容旨在傳播知識,若有侵權(quán)等問題請及時與本網(wǎng)聯(lián)系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com