sysbench 測試mysql的學習過程

來源:互聯網
上載者:User

標籤:

1.測試mysql前的準備工作

//建立一張測試的資料表
sysbench --test=oltp#指定測試模式 --mysql-table-engine=myisam#指定測試引擎 --oltp-table-size=8000000#建表時候插入800W資料
--db-driver=mysql#設定驅動為mysql --mysql-user=root --mysql-password=‘123456‘ --mysql-db=test#登陸資料庫,並使用test資料庫 prepare#開啟測試前的準備工作;

2.開始測試 在prepare操作上增加幾個參數,就可以運行測試了

sysbench --test=oltp --oltp-table-size=8000000 --oltp-read-only=off# 是否開啟唯讀模式,預設就是off --init-rng=on#分布的隨機數設定為均勻分布  --num-threads=16#開啟8個並發線程 --max-requests=0#表示總請求數為 0,因為上面已經定義了總執行時間長度,所以總請求數可以設定為 0;也可以只設定總請求數,不設定最大執行時間長度
--oltp-dist-type=uniform#表示隨機類型為固定模式,其他幾個可選隨機模式:uniform(固定),gaussian(高斯),special(特定的),pareto(帕累托) --max-time=600#測試時間 --mysql-user=root --mysql-password=‘123456‘ --mysql-db=test --db-driver=mysql run > result.log#把資訊輸出到result.log檔案中

 

3.收尾工作 (會把測試表刪除)

sysbench --test=oltp --oltp-table-size=8000000 --mysql-db=test --mysql-user=root --db-driver=mysql --mysql-password=‘123456‘ cleanup

 

 

result.log檔案資訊如下:

/**測試回合的資訊**/
sysbench 0.4.12: multi-threaded system evaluation benchmark

Running the test with following options:
Number of threads: 8
Initializing random number generator from timer.


Doing OLTP test.
Running mixed OLTP test
Using Uniform distribution
Using "LOCK TABLES WRITE" for starting transactions
Using auto_inc on the id column
Threads started!
Time limit exceeded, exiting...
(last message repeated 7 times)
Done.
/**結束**/
OLTP test statistics:
queries performed:
read: 3983322 #讀總數
write: 1422615 #寫總數
other: 569046 #增刪改查之外的運算元,比如commit
total: 5974983 #全部總數
transactions: 284523 (158.05 per sec.)#總事務數(每秒事務數)
deadlocks: 0 (0.00 per sec.) #發生死結總數
read/write requests: 5405937 (3003.03 per sec.)# 讀寫總數(每秒讀寫次數)
other operations: 569046 (316.11 per sec.) #其他動作總數(每秒其他動作次數)

//測試統計資料
Test execution summary:
total time: 1800.1609s #總耗時
total number of events: 284523 #總發生事務數
total time taken by event execution: 14399.6619 #所有事務耗時相加(不考慮並行因素)
per-request statistics:#響應時間長度統計
min: 14.04ms #最小耗時
avg: 50.61ms #平均耗時
max: 7566.70ms #最高耗時
approx. 95 percentile: 47.30ms #超過95%平均耗時
//線程公平性統計資訊
Threads fairness:
events (avg/stddev): 35565.3750/2.23
execution time (avg/stddev): 1799.9577/0.05

 

sysbench 測試mysql的學習過程

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.