如何用mysqlslap进行压力测试
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/11/09 09:54:39
如何用mysqlslap进行压力测试
首先mysql/bin 目录里应该有mysqlslap.exe,我的版本是 5.5.11,里面是有这玩意的
在执行之前需要在mysql里建一个mysqlslap的database
use mysqlslap
然后建表news,classify输数据...
在命令行里输入:
C:\Program Files\MySQL\MySQL Server 5.5\bin>mysqlslap -u root –no-defaults -p -c
reate-schema=example --query="SELECT n.* FROM news n,classify c WHERE n.type=c.id AND c.type='2'" --iterations=1000
其中-u为username,-p为使用密码,query引号后的内容为执行的测试的sql,循环1000次
要求输入密码
Enter password: ****
结果:
Benchmark
Average number of seconds to run all queries: 0.007 seconds
Minimum number of seconds to run all queries: 0.000 seconds
Maximum number of seconds to run all queries: 1.016 seconds
Number of clients running queries: 1
Average number of queries per client: 1
在执行之前需要在mysql里建一个mysqlslap的database
use mysqlslap
然后建表news,classify输数据...
在命令行里输入:
C:\Program Files\MySQL\MySQL Server 5.5\bin>mysqlslap -u root –no-defaults -p -c
reate-schema=example --query="SELECT n.* FROM news n,classify c WHERE n.type=c.id AND c.type='2'" --iterations=1000
其中-u为username,-p为使用密码,query引号后的内容为执行的测试的sql,循环1000次
要求输入密码
Enter password: ****
结果:
Benchmark
Average number of seconds to run all queries: 0.007 seconds
Minimum number of seconds to run all queries: 0.000 seconds
Maximum number of seconds to run all queries: 1.016 seconds
Number of clients running queries: 1
Average number of queries per client: 1