mysql压测工具测试
mysql压测工具测试
一、mysql自带压测工具mysqlslap
1、更改其默认的最大连接数
vi /etc/my.cnf
max_connections=2000
2、查看最大连接数
show variables like '%max_connects%';
3、进行压力测试
mysqlslap --defaults-file=/etc/my.cnf \
--concurrency=100,200 \ ---模拟两次读写并发,第一次100,第二次200
--iterations=20 \ ---模拟查询20秒
--number-int-cols=20 \ ---测试表包含20个init字段
--number-char-cols=30 \ ---测试表包含30个char字段
--auto-generate-sql \ ---自动生成SQL脚本
--auto-generate-sql-add-autoincrement \ ---自动添加一个自动增长的列到测试表
--auto-generate-sql-load-type=mixed \ ---指定测试加载类型
--engine=myisam,innodb \ ---测试引擎分别为myisam、innodb
--number-of-queries=2000 \ ---每次执行2000个查询请求
--query=query.sql ---指定模拟查询用sql文件
--create=create.sql ---指定模拟创建用sql文件
-uroot -pcqfae0630 \ ---用户名、密码
--verbose ---详细模式,打印有关详细信息
4、测试结果
Benchmark
Running for engine myisam
Average number of seconds to run all queries: 1.338 seconds
Minimum number of seconds to run all queries: 1.338 seconds
Maximum number of seconds to run all queries: 1.338 seconds
Number of clients running queries: 100
Average number of queries per client: 20
Benchmark
Running for engine myisam
Average number of seconds to run all queries: 1.203 seconds
Minimum number of seconds to run all queries: 1.203 seconds
Maximum number of seconds to run all queries: 1.203 seconds
Number of clients running queries: 200
Average number of queries per client: 10
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: 20
Benchmark
Running for engine innodb
Average number of seconds to run all queries: 0.142 seconds
Minimum number of seconds to run all queries: 0.142 seconds
Maximum number of seconds to run all queries: 0.142 seconds
Number of clients running queries: 200
Average number of queries per client: 10
二、第三方压测工具sysbench