请选择 进入手机版 | 继续访问电脑版
查看: 734|回复: 0

[Mysql数据库] mysql压力测试工具(mysqlslap)

3万

主题

3万

帖子

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
100167
发表于 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
复制代码


回复

使用道具 举报