您的位置:首页 > 数据库 > MySQL

mysql相关开源工具

2011-02-23 13:46 204 查看
MySQL 扩展和优化工具 Google MySQL Tools

Google MySQL Tools 是一组用来管理、维护和提升 MySQL 数据库性能的工具,由 Google 公司开发。

该工具目前包括:

mypgrep.py - a tool, similar to pgrep, for managing mysql connections

compact_innodb.py - compacts innodb datafiles by dumping and reloading all tables

patches - patches to add features to MySQL 4.0.26 and MySQL 5.0.37

MySQL 的 5.4 版本就是基于该工具进行扩展的。

MySQL压力测试工具 mysqlslap

mysqlslap是一个mysql官方提供的压力测试工具。以下是比较重要的参数:
–defaults-file,配置文件存放位置
–concurrency,并发数
–engines,引擎
–iterations,迭代的实验次数
–socket,socket文件位置

自动测试:
–auto-generate-sql,自动产生测试SQL
–auto-generate-sql-load-type,测试SQL的类型。类型有mixed,update,write,key,read。
–number-of-queries,执行的SQL总数量
–number-int-cols,表内int列的数量
–number-char-cols,表内char列的数量

例如:
shell>mysqlslap –defaults-file=/u01/mysql1/mysql/my.cnf –concurrency=50,100 –iterations=1 –number-int-cols=4 –auto-generate-sql –auto-generate-sql-load-type=write –engine=myisam –number-of-queries=200 -S/tmp/mysql1.sock
Benchmark
Running for engine myisam
Average number of seconds to run all queries: 0.016 seconds
Minimum number of seconds to run all queries: 0.016 seconds
Maximum number of seconds to run all queries: 0.016 seconds
Number of clients running queries: 50
Average number of queries per client: 4

Benchmark
Running for engine myisam
Average number of seconds to run all queries: 0.265 seconds
Minimum number of seconds to run all queries: 0.265 seconds
Maximum number of seconds to run all queries: 0.265 seconds
Number of clients running queries: 100
Average number of queries per client: 2

指定数据库的测试:
–create-schema,指定数据库名称
–query,指定SQL语句,可以定位到某个包含SQL的文件

例如:
shell>mysqlslap –defaults-file=/u01/mysql1/mysql/my.cnf –concurrency=25,50 –iterations=1 –create-schema=test –query=/u01/test.sql -S/tmp/mysql1.sock
Benchmark
Average number of seconds to run all queries: 0.018 seconds
Minimum number of seconds to run all queries: 0.018 seconds
Maximum number of seconds to run all queries: 0.018 seconds
Number of clients running queries: 25
Average number of queries per client: 1

Benchmark
Average number of seconds to run all queries: 0.011 seconds
Minimum number of seconds to run all queries: 0.011 seconds
Maximum number of seconds to run all queries: 0.011 seconds
Number of clients running queries: 50
Average number of queries per client: 1
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息