mysqlslap性能测试工具

常用参数

 1 –concurrency #代表并发数量,多个可以用逗号隔开。例如:–concurrency=50,200,500
 2 –engines #代表要测试的引擎,可以有多个,用分隔符隔开。例如:–engines=myisam,innodb,memory
 3 –iterations #代表要在不同并发环境下,各自运行测试多少次。
 4 –auto-generate-sql #代表用mysqlslap工具自己生成的SQL脚本来测试并发压力。
 5 –auto-generate-sql-add-auto-increment #代表对生成的表自动添加auto_increment列,从5.1.18版本开始,
 6 –auto-generate-sql-load-type #代表要测试的环境是读操作还是写操作还是两者混合的(read,write,update,mixed)
 7 –number-of-queries #代表总共要运行多少条查询。
 8 –debug-info #代表要额外输出CPU以及内存的相关信息。
 9 –number-int-cols #代表示例表中的INTEGER类型的属性有几个。
10 –number-char-cols #代表示例表中的vachar类型的属性有几个。
11 –create-schema #代表自定义的测试库名称。
12 –query #代表自定义的测试SQL脚本。

 

 1 default:
 2 mysqlslap -uroot -p6yhn^YHN --concurrency=100 --iterations=1 --auto-generate-sql --auto-generate-sql-add-autoincrement --auto-generate-sql-load-type=mixed --engine=innodb,myisam --number-of-queries=10
 3 
 4 [mysql@mysql ~]$ mysqlslap -uroot -p6yhn^YHN --concurrency=100 --iterations=1 --auto-generate-sql --auto-generate-sql-add-autoincrement --auto-generate-sql-load-type=mixed --engine=innodb,myisam --number-of-queries=10 
 5 mysqlslap: [Warning] Using a password on the command line interface can be insecure.
 6 
 7 Benchmark
 8 Running for engine innodb
 9 Average number of seconds to run all queries: 0.406 seconds
10 Minimum number of seconds to run all queries: 0.406 seconds
11 Maximum number of seconds to run all queries: 0.406 seconds
12 Number of clients running queries: 100
13 Average number of queries per client: 0
14 
15 Benchmark
16 Running for engine myisam
17 Average number of seconds to run all queries: 2.512 seconds
18 Minimum number of seconds to run all queries: 2.512 seconds
19 Maximum number of seconds to run all queries: 2.512 seconds
20 Number of clients running queries: 100
21 Average number of queries per client: 0

 

 

指定数据库和查询语句

 1 mysqlslap -uroot -p6yhn^YHN --concurrency=100 --iterations=1 --create-schema='ecology' --query='select * from test1;' --number-of-queries=10
 2 
 3 [mysql@mysql ~]$ mysqlslap -uroot -p6yhn^YHN --concurrency=100 --iterations=1 --create-schema='ecology' --query='select * from test1;' --number-of-queries=10 
 4 mysqlslap: [Warning] Using a password on the command line interface can be insecure.
 5 
 6 Benchmark
 7 Average number of seconds to run all queries: 0.021 seconds
 8 Minimum number of seconds to run all queries: 0.021 seconds
 9 Maximum number of seconds to run all queries: 0.021 seconds
10 Number of clients running queries: 100
11 Average number of queries per client: 0

 

posted on 2020-09-28 10:06  数据派  阅读(224)  评论(0编辑  收藏  举报