mysqlslap工具使用
(2008-08-27 14:19:12)
工具运行分为4个步骤:
创建数据库和表
插入数据
执行查询更新等操作 query(测试的主要内容)以下称为查询
删除数据库
1.使用自动生成的脚本测试
mysqlslap --help可以查看具体的参数的用法
例子:mysqlslap --concurrency=50,100,200 --iterations=20 --number-int-cols=4 --number-char-cols=35 --auto-generate-sql --auto-generate-sql-add-autoincrement --auto-generate-sql-load-type=read --engine=myisam,innodb --number-of-queries=200 --verbose --socket=/usr/local/mysql1/var/mysql.sock -u root -p123
使用系统自带的脚本测试,增加auto_increment一列,int4列char35列,测试2种引擎myisam,innodb读的性能分别用50,100,200个客户端对服务器进行测试总共200个查询语句 执行20次查询
加个--only-print不连接数据库只打印要做什么
Benchmark
Running for engine myisam
Average number of seconds to run all queries: 0.897 seconds
Minimum number of seconds to run all queries: 0.081 seconds
Maximum number of seconds to run all queries: 1.239 seconds
Number of clients running queries: 50
Average number of queries per client: 4
###### 50个并发客户端 平均每个客户端4个查询 20次查询中最少的时间是0.081秒、 最多1.239秒、平均0.897秒。
Benchmark
Running for engine myisam
Average number of seconds to run all queries: 1.544 seconds
Minimum number of seconds to run all queries: 0.000 seconds
Maximum number of seconds to run all queries: 4.174 seconds
Number of clients running queries: 100
Average number of queries per client: 2
Benchmark
Running for engine myisam
Average number of seconds to run all queries: 1.671 seconds
Minimum number of seconds to run all queries: 0.005 seconds
Maximum number of seconds to run all queries: 5.724 seconds
Number of clients running queries: 200
Average number of queries per client: 1
Benchmark
Running for engine innodb
Average number of seconds to run all queries: 1.074 seconds
Minimum number of seconds to run all queries: 0.000 seconds
Maximum number of seconds to run all queries: 1.994 seconds
Number of clients running queries: 50
Average number of queries per client: 4
Benchmark
Running for engine innodb
Average number of seconds to run all queries: 1.088 seconds
Minimum number of seconds to run all queries: 0.000 seconds
Maximum number of seconds to run all queries: 1.793 seconds
Number of clients running queries: 100
Average number of queries per client: 2
Benchmark
Running for engine innodb
Average number of seconds to run all queries: 1.415 seconds
Minimum number of seconds to run all queries: 0.006 seconds
Maximum number of seconds to run all queries: 2.212 seconds