以下的文章主要介紹的是MySQL壓力測試工具,我們大家都知道MySQL數據庫在實際應用中可以說應用率還是不算低的,采用MySQL數據庫也一般是中小企業,以下的文章就主要介紹的是MySQL數據庫的壓力測試工具。
MySQLslap
July 4th, 2009 Leave a comment Go to comments
MySQLslap是一個MySQL官方提供的壓力測試工具。以下是比較重要的參數:
–defaults-file,配置文件存放位置
–concurrency,並發數
–engines,引擎
–iterations,迭代的實驗次數
–socket,socket文件位置
自動測試:
–auto-generate-sql,自動產生測試SQL
–auto-generate-sql-load-type,測試SQL的類型。類型有mixed,update,write,key,read。
–number-of-queries,執行的SQL總數量
–number-int-cols,表內int列的數量
–number-char-cols,表內char列的數量
例如:
shell>MySQLslap –defaults-file=/u01/MySQL1/MySQL/my.cnf –concurrency=50,100 –iterations=1 –number-int-cols=4 –auto-generate-sql –auto-generate-sql-load-type=write –engine=myisam –number-of-queries=200 -S/tmp/MySQL1.sock
Benchmark
Running for engine myisam
Average number of seconds to run all queries: 0.016 seconds
Minimum number of seconds to run all queries: 0.016 seconds
Maximum number of seconds to run all queries: 0.016 seconds
Number of clients running queries: 50
Average number of queries per client: 4
Benchmark
Running for engine myisam
Average number of seconds to run all queries: 0.265 seconds
Minimum number of seconds to run all queries: 0.265 seconds
Maximum number of seconds to run all queries: 0.265 seconds
Number of clients running queries: 100
Average number of queries per client: 2
MySQL壓力測試工具中指定數據庫的測試:
–create-schema,指定數據庫名稱
–query,指定SQL語句,可以定位到某個包含SQL的文件
例如:
shell>MySQLslap –defaults-file=/u01/MySQL1/MySQL/my.cnf –concurrency=25,50 –iterations=1 –create-schema=test –query=/u01/test.sql -S/tmp/MySQL1.sock
Benchmark
Average number of seconds to run all queries: 0.018 seconds
Minimum number of seconds to run all queries: 0.018 seconds
Maximum number of seconds to run all queries: 0.018 seconds
Number of clients running queries: 25
Average number of queries per client: 1
Benchmark
Average number of seconds to run all queries: 0.011 seconds
Minimum number of seconds to run all queries: 0.011 seconds
Maximum number of seconds to run all queries: 0.011 seconds
Number of clients running queries: 50
Average number of queries per client: 1
以上的相關內容就是對MySQL壓力測試工具的介紹,望你能有所收獲。