Amoeba for MySQL Benchmark使用示例

可以通过配置文件指定Benchmark执行某些SQL语句,首先配置benchmark目录下的query.xml文件(如果没有则新建一个)。

Example 6.1. 一个基本的Benchmark的query文件

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties version="1.0">
 <entry key="class">com.meidusa.amoeba.mysql.net.packet.QueryCommandPacket</entry>
 <entry key="command">3</entry>
 <entry key="query"><![CDATA[
                    select now()1
                    ]]>
 </entry>
</properties>

1

指定需要进行性能测试的语句。


运行benchmark:

$  ./benchmark -P 8066 -c 50 -f ../benchmark/query.xml -h localhost -n 100000 -u root -p password1
log4j:WARN log4j config load completed from file:/home/amoeba-mysql-binary-2.0.2-BETA/conf/log4j.xml  
Connection manager started....

connect to ip=localhost,port=3306,connection size=5,total request=100000
Wed Mar 09 16:21:38 CST 2011     compeleted=0 TPS=0 ,conns=0
Wed Mar 09 16:21:39 CST 2011     compeleted=9897 TPS=9897 ,conns=5
Wed Mar 09 16:21:40 CST 2011     compeleted=33455 TPS=23558 ,conns=5
Wed Mar 09 16:21:41 CST 2011     compeleted=59645 TPS=26190 ,conns=5
Wed Mar 09 16:21:43 CST 2011     compeleted=99997 TPS=40352 ,conns=5
completed requests total=100000, errorNum=0, cost=4900ms , TPS=20408/s
min=0ms
max=594ms
average=0ms
create Connections time=37ms
TPS(after connected)=20416/s