一、软件包
a) Percona-Server-shared-55-5.5.8-beta20.0.46.rhel5.i686.rpm
b) Percona-Server-client-55-5.5.8-beta20.0.46.rhel5.i686.rpm
c) Percona-Server-server-55-5.5.8-beta20.0.46.rhel5.i686.rpm
二、安装步骤
a) Rpm –ivh Percona-Server-shared-55-5.5.8-beta20.0.46.rhel5.i686.rpm
b) Rpm –ivh Percona-Server-client-55-5.5.8-beta20.0.46.rhel5.i686.rpm
c) Rpm –ivh Percona-Server-server-55-5.5.8-beta20.0.46.rhel5.i686.rpm
d) /usr/bin/mysql -uroot –p刚开始密码为空
e) Mysql>use mysql;
f) Mysql>update user set password=password(‘123456’) where user=’root’ //root的密码设置为123456
g) Mysql>flush privileges;
h) Service mysql restart
i) /usr/bin/mysqlslap –uroot -p -a –concurrency=50,100 –-number-of-queries 1000 –-debug-info//并发50到100查询次数为1000次
Benchmark
Average number of seconds to run all queries: 2.874 seconds
Minimum number of seconds to run all queries: 2.874 seconds
Maximum number of seconds to run all queries: 2.874 seconds
Number of clients running queries: 1
Average number of queries per client: 1000
Benchmark
Average number of seconds to run all queries: 2.746 seconds
Minimum number of seconds to run all queries: 2.746 seconds
Maximum number of seconds to run all queries: 2.746 seconds
Number of clients running queries: 2
Average number of queries per client: 500
Benchmark
Average number of seconds to run all queries: 2.192 seconds
Minimum number of seconds to run all queries: 2.192 seconds
Maximum number of seconds to run all queries: 2.192 seconds
Number of clients running queries: 3
Average number of queries per client: 333
Benchmark
Average number of seconds to run all queries: 2.118 seconds
Minimum number of seconds to run all queries: 2.118 seconds
Maximum number of seconds to run all queries: 2.118 seconds
Number of clients running queries: 4
Average number of queries per client: 250
j) /usr/bin/mysqlslap –uroot –p –concurrency=50,100 –-number-of-queries 1000 –-debug-info –query=’select * from discuz.uc_members’//并发50到100查询次数为1000次单SQL语句测试
Benchmark
Average number of seconds to run all queries: 1.596 seconds
Minimum number of seconds to run all queries: 1.596 seconds
Maximum number of seconds to run all queries: 1.596 seconds
Number of clients running queries: 1
Average number of queries per client: 1000
Benchmark
Average number of seconds to run all queries: 1.629 seconds
Minimum number of seconds to run all queries: 1.629 seconds
Maximum number of seconds to run all queries: 1.629 seconds
Number of clients running queries: 2
Average number of queries per client: 500
Benchmark
Average number of seconds to run all queries: 1.639 seconds
Minimum number of seconds to run all queries: 1.639 seconds
Maximum number of seconds to run all queries: 1.639 seconds
Number of clients running queries: 3
Average number of queries per client: 333
Benchmark
Average number of seconds to run all queries: 1.645 seconds
Minimum number of seconds to run all queries: 1.645 seconds
Maximum number of seconds to run all queries: 1.645 seconds
Number of clients running queries: 4
Average number of queries per client: 250
k) 从测试结果来说个人感觉并不是很理想!mysqlslap并发数和请求数多,原因表中没几条数据,也可能时间都浪费在创建线程上也不一定。还是和其它压力测试工具一样,会出来线程无法再创建的问题。
三、附mysqlslap参数说明
–auto-generate-sql, -a
自动生成测试表和数据
–auto-generate-sql-load-type=type
测试语句的类型。取值包括:read,key,write,update和mixed(默认)。
–number-char-cols=N, -x N
自动生成的测试表中包含多少个字符类型的列,默认1
–number-int-cols=N, -y N
自动生成的测试表中包含多少个数字类型的列,默认1
–number-of-queries=N
总的测试查询次数(并发客户数×每客户查询次数)
–query=name,-q
使用自定义脚本执行测试,例如可以调用自定义的一个存储过程或者sql语句来执行测试。
–create-schema
测试的schema,MySQL中schema也就是database
–commint=N
多少条DML后提交一次
–compress, -C
如果服务器和客户端支持都压缩,则压缩信息传递
–concurrency=N, -c N
并发量,也就是模拟多少个客户端同时执行select。可指定多个值,以逗号或者–delimiter参数指定的值做为分隔符
–engine=engine_name, -e engine_name
创建测试表所使用的存储引擎,可指定多个
–iterations=N, -i N
测试执行的迭代次数
–detach=N
执行N条语句后断开重连
–debug-info, -T
打印内存和CPU的信息
–only-print
只打印测试语句而不实际执行
Percona-Server编译安装一直没搞明白,好像是要先装MYSQL直接拷贝Percona-Server的tar.gz包的内容覆盖掉装的MYSQL结果。