您的位置:軟件測試 > 開源軟件測試 > 開源性能測試工具 >
壓力測試工具Myysqlslap測試Mysql服務(wù)器性能
作者:網(wǎng)絡(luò)轉(zhuǎn)載 發(fā)布時間:[ 2013/1/21 15:35:38 ] 推薦標(biāo)簽:

關(guān)于他的選項手冊上以及--help介紹的很詳細(xì)。
我解釋一下一些常用的選項。

這里要注意的幾個選項:

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


1、用自帶的SQL腳本來測試。
MySQL版本為5.1.23
[root@localhost ~]# mysqlslap --defaults-file=/usr/local/mysql-maria/my.cnf --concurrency=50,100,200 --iterations=1 --number-int-cols=4 --number-char-cols=35 --auto-generate-sql --auto-generate-sql-add-autoincrement --auto-generate-sql-load-type=mixed --engine=myisam,innodb --number-of-queries=200 --debug-info -uroot -p1 -S/tmp/mysql_3310.sock
Benchmark
        Running for engine myisam
        Average number of seconds to run all queries: 0.063 seconds
        Minimum number of seconds to run all queries: 0.063 seconds
        Maximum number of seconds to run all queries: 0.063 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.070 seconds
        Minimum number of seconds to run all queries: 0.070 seconds
        Maximum number of seconds to run all queries: 0.070 seconds
        Number of clients running queries: 100
        Average number of queries per client: 2
Benchmark
        Running for engine myisam
        Average number of seconds to run all queries: 0.092 seconds
        Minimum number of seconds to run all queries: 0.092 seconds
        Maximum number of seconds to run all queries: 0.092 seconds
        Number of clients running queries: 200
        Average number of queries per client: 1
Benchmark
        Running for engine innodb
        Average number of seconds to run all queries: 0.115 seconds
        Minimum number of seconds to run all queries: 0.115 seconds
        Maximum number of seconds to run all queries: 0.115 seconds
        Number of clients running queries: 50
        Average number of queries per client: 4
Benchmark
        Running for engine innodb
        Average number of seconds to run all queries: 0.134 seconds
        Minimum number of seconds to run all queries: 0.134 seconds
        Maximum number of seconds to run all queries: 0.134 seconds
        Number of clients running queries: 100

        Average number of queries per client: 2
Benchmark
        Running for engine innodb
        Average number of seconds to run all queries: 0.192 seconds
        Minimum number of seconds to run all queries: 0.192 seconds
        Maximum number of seconds to run all queries: 0.192 seconds
        Number of clients running queries: 200
        Average number of queries per client: 1
User time 0.06, System time 0.15
Maximum resident set size 0, Integral resident set size 0
Non-physical pagefaults 5803, Physical pagefaults 0, Swaps 0
Blocks in 0 out 0, Messages in 0 out 0, Signals 0
Voluntary context switches 8173, Involuntary context switches 528
我來解釋一下結(jié)果的含義。拿每個引擎后一個Benchmark示例。對于INNODB引擎,200個客戶端同時運行這些SQL語句平均要花0.192秒。相應(yīng)的MYISAM為0.092秒。


2、用我們自己定義的SQL 腳本來測試。
這些數(shù)據(jù)在另外一個MySQL實例上。版本為5.0.45先看一下這兩個表的相關(guān)數(shù)據(jù)。
1)、總記錄數(shù)。
mysql> select table_rows as rows from information_schema.tables where table_schema='t_girl' and table_name='article';
+--------+
| rows     |
+--------+
| 296693 |
+--------+
1 row in set (0.01 sec)
mysql> select table_rows as rows from information_schema.tables where table_schema='t_girl' and table_name='category';
+------+
| rows |
+------+
|  113  |
+------+
1 row in set (0.00 sec)
2)、總列數(shù)。
mysql> select count(*) as column_total from information_schema.columns where table_schema = 't_girl' and table_name = 'article';
+--------------+
| column_total |
+--------------+
|           32           |
+--------------+
1 row in set (0.01 sec)
mysql> select count(*) as column_total from information_schema.columns where table_schema = 't_girl' and table_name = 'category';
+--------------+
| column_total |
+--------------+
|            9            |
+--------------+
1 row in set (0.01 sec)

上一頁12下一頁
軟件測試工具 | 聯(lián)系我們 | 投訴建議 | 誠聘英才 | 申請使用列表 | 網(wǎng)站地圖
滬ICP備07036474 2003-2017 版權(quán)所有 上海澤眾軟件科技有限公司 Shanghai ZeZhong Software Co.,Ltd