查看: 1575|回復: 0

[Mysql數據庫] mysql壓力測試工具(mysqlslap)

3萬

主題

3萬

帖子

10萬

積分

管理員

Rank: 9Rank: 9Rank: 9

積分
100197
發表于 2015-12-2 18:44:47

mysql壓力測試工具(mysqlslap),有需要的朋友可以參考下。


使用說明

–concurrency代表并發數量,多個可以用逗號隔開,當然你也可以用自己的分隔符隔開,這個時候要用到–delimiter開關。
–engines代表要測試的引擎,可以有多個,用分隔符隔開。
–iterations代表要運行這些測試多少次。
–auto-generate-sql 代表用系統自己生成的SQL腳本來測試。
–auto-generate-sql-load-type 代表要測試的是讀還是寫還是兩者混合的(read,write,update,mixed)
–number-of-queries 代表總共要運行多少次查詢。每個客戶運行的查詢數量可以用查詢總數/并發數來計算。比如倒數第二個結果2=200/100。
–debug-info 代表要額外輸出CPU以及內存的相關信息。
–number-int-cols 代表示例表中的INTEGER類型的屬性有幾個。
–number-char-cols 意思同上。
–create-schema 代表自己定義的模式(在MySQL中也就是庫)。
–query 代表自己的SQL腳本。
–only-print 如果只想打印看看SQL語句是什么,可以用這個選項。

使用例子

./mysqlslap -a -c 10 -i 100 -uroot -S /var/lib/mysql/mysql.sock –engine=myisam –debug-info –auto-generate-sql –auto-generate-sql-load-type=read

測試結果 read
  1. Running for engine myisam
  2. Average number of seconds to run all queries: 0.033 seconds
  3. Minimum number of seconds to run all queries: 0.027 seconds
  4. Maximum number of seconds to run all queries: 0.065 seconds
  5. Running for engine innodb
  6. Average number of seconds to run all queries: 0.043 seconds
  7. Minimum number of seconds to run all queries: 0.035 seconds
  8. Maximum number of seconds to run all queries: 0.078 seconds
  9. Running for engine tokudb
  10. Average number of seconds to run all queries: 0.043 seconds
  11. Minimum number of seconds to run all queries: 0.034 seconds
  12. Maximum number of seconds to run all queries: 0.089 seconds
復制代碼
write
  1. Running for engine myisam
  2. Average number of seconds to run all queries: 0.011 seconds
  3. Minimum number of seconds to run all queries: 0.009 seconds
  4. Maximum number of seconds to run all queries: 0.024 seconds
  5. Running for engine innodb
  6. Average number of seconds to run all queries: 0.142 seconds
  7. Minimum number of seconds to run all queries: 0.051 seconds
  8. Maximum number of seconds to run all queries: 2.033 seconds
  9. Running for engine tokudb
  10. Average number of seconds to run all queries: 0.098 seconds
  11. Minimum number of seconds to run all queries: 0.044 seconds
  12. Maximum number of seconds to run all queries: 0.697 seconds
復制代碼
update
  1. Running for engine myisam
  2. Average number of seconds to run all queries: 0.089 seconds
  3. Minimum number of seconds to run all queries: 0.063 seconds
  4. Maximum number of seconds to run all queries: 0.200 seconds
  5. Running for engine innodb
  6. Average number of seconds to run all queries: 0.314 seconds
  7. Minimum number of seconds to run all queries: 0.176 seconds
  8. Maximum number of seconds to run all queries: 1.125 seconds
  9. Running for engine tokudb
  10. Average number of seconds to run all queries: 0.246 seconds
  11. Minimum number of seconds to run all queries: 0.164 seconds
  12. Maximum number of seconds to run all queries: 0.695 seconds
復制代碼
mixed
  1. Running for engine myisam
  2. Average number of seconds to run all queries: 0.024 seconds
  3. Minimum number of seconds to run all queries: 0.019 seconds
  4. Maximum number of seconds to run all queries: 0.099 seconds
  5. Running for engine innodb
  6. Average number of seconds to run all queries: 0.091 seconds
  7. Minimum number of seconds to run all queries: 0.057 seconds
  8. Maximum number of seconds to run all queries: 0.584 seconds
  9. Running for engine tokudb
  10. Average number of seconds to run all queries: 0.078 seconds
  11. Minimum number of seconds to run all queries: 0.054 seconds
  12. Maximum number of seconds to run all queries: 0.268 seconds
復制代碼


回復

使用道具 舉報