집 >데이터 베이스 >MySQL 튜토리얼 >Amoeba For MySQL 功能测试让人满意
同事 Struct Chen 的 Amoeba For MySQL 项目已经 出来不短时间了,可一直没有时间好好体验,最近一直在做一些软件和硬件的功能以及性能相关的测试工作,Amoeba For MySQL自然也将被列入计划之内。 对 Amoeba For MySQL 的测试到目前位置主要还是功能方面的测
同事 Struct Chen 的 Amoeba For MySQL 项目已经 出来不短时间了,可一直没有时间好好体验,最近一直在做一些软件和硬件的功能以及性能相关的测试工作,Amoeba For MySQL自然也将被列入计划之内。
对 Amoeba For MySQL 的测试到目前位置主要还是功能方面的测试,配置了一套四台机器的环境:
Server A: Amoeba Server
Server B: MySQL Master
Server C: MySQL Slave1
Server D: MySQL Slave2
软件环境:RHEL5.2 (X86_64),JAVA 1.5.0_16, Amoeba For MySQL 0.31
测试功能:
1、读写分离
2、数据垂直切分
3、数据水平切分
amoeba.xml配置如下:
?xmlversion="1.0"encoding="gbk"?>
!DOCTYPEamoeba:configurationSYSTEM"amoeba.dtd">
amoeba:configurationxmlns:amoeba="http://amoeba.meidusa.com/">
server>
propertyname="port">8066property>
propertyname="ipAddress">10.0.38.21property>
propertyname="readThreadPoolSize">500property>
propertyname="clientSideThreadPoolSize">500property>
propertyname="serverSideThreadPoolSize">500property>
propertyname="netBufferSize">200property>
propertyname="tcpNoDelay">trueproperty>
propertyname="user">userproperty>
propertyname="password">passwordproperty>
server>
connectionmanagerlist>
connectionmanagername="defaultManager">
classname>com.meidusa.amoeba.net.AuthingableConnectionManagerclassname>
connectionmanager>
connectionmanagerlist>
dbserverlist>
dbservername="master">
factoryconfig>
classname>com.meidusa.amoeba.mysql.net.MysqlServerConnectionFactoryclassname>
propertyname="manager">defaultManagerproperty>
propertyname="port">3306property>
propertyname="ipAddress">10.0.38.37property>
propertyname="schema">testproperty>
propertyname="user">rootproperty>
propertyname="password">passwordproperty>
factoryconfig>
poolconfig>
classname>com.meidusa.amoeba.net.poolable.PoolableObjectPoolclassname>
propertyname="maxActive">500property>
propertyname="maxIdle">200property>
propertyname="minIdle">10property>
propertyname="minEvictableIdleTimeMillis">600000property>
propertyname="timeBetweenEvictionRunsMillis">600000property>
propertyname="testOnBorrow">trueproperty>
propertyname="testWhileIdle">trueproperty>
poolconfig>
dbserver>
dbservername="slave1">
factoryconfig>
classname>com.meidusa.amoeba.mysql.net.MysqlServerConnectionFactoryclassname>
propertyname="manager">defaultManagerproperty>
propertyname="port">3306property>
propertyname="ipAddress">10.0.38.22property>
propertyname="schema">testproperty>
propertyname="user">rootproperty>
propertyname="password">passwordproperty>
factoryconfig>
poolconfig>
classname>com.meidusa.amoeba.net.poolable.PoolableObjectPoolclassname>
propertyname="maxActive">500property>
propertyname="maxIdle">200property>
propertyname="minIdle">10property>
propertyname="minEvictableIdleTimeMillis">600000property>
propertyname="timeBetweenEvictionRunsMillis">600000property>
propertyname="testOnBorrow">trueproperty>
propertyname="testWhileIdle">trueproperty>
poolconfig>
dbserver>
dbservername="slave2">
factoryconfig>
... ...
factoryconfig>
poolconfig>
... ...
poolconfig>
dbserver>
dbservername="virtualSlave"virtual="true">
poolconfig>
classname>com.meidusa.amoeba.server.MultipleServerPoolclassname>
propertyname="loadbalance">1property>
propertyname="poolNames">slave1,slave2property>
poolconfig>
dbserver>
dbserverlist>
queryrouter>
classname>com.meidusa.amoeba.mysql.parser.MysqlQueryRouterclassname>
propertyname="ruleConfig">${amoeba.home}/conf/rule.xmlproperty>
propertyname="functionConfig">${amoeba.home}/conf/functionMap.xmlproperty>
propertyname="ruleFunctionConfig">${amoeba.home}/conf/ruleFunctionMap.xmlproperty>
propertyname="LRUMapSize">1500property>
propertyname="defaultPool">masterproperty>
propertyname="writePool">masterproperty>
propertyname="readPool">virtualSlaveproperty>
propertyname="needParse">trueproperty>
queryrouter>
amoeba>
rule.xml配置:
?xmlversion="1.0"encoding="gbk"?>
!DOCTYPEamoeba:ruleSYSTEM"rule.dtd">
amoeba:rulexmlns:amoeba="http://amoeba.meidusa.com/">
tablerulename="test_horiz"schema="test"defaultPools="master">
rulename="rule1">
parameters>IDparameters>
expression> ![CDATA[ ID 100000000]]>expression>
defaultpools>masterdefaultpools>
readpools>slave1readpools>
writepools>masterwritepools>
rule>
rulename="rule2">
parameters>IDparameters>
expression> ![CDATA[ IDbetween100000001and200000000 ]]>expression>
defaultpools>masterdefaultpools>
writepools>master2writepools>
readpools>slave2readpools>
rule>
rulename="rule3">
parameters>IDparameters>
expression> ![CDATA[ ID> 200000000 ]]>expression>
defaultpools>masterdefaultpools>
rule>
tablerule>
tablerulename="master"schema="test"defaultPools="master"/>
tablerulename="slave1"schema="test"defaultPools="slave1"/>
tablerulename="slave2"schema="test"defaultPools="slave2"/>
tablerulename="master"schema="t"defaultPools="master"/>
amoeba>
由于第一步主要还只是测试读写分离与数据的垂直切分,所以水平切分的规则设置的很简单,仅仅是按照ID的范围设置简单的规则。而设置一些更为复杂的规则。
总体测试效果还是比较满意的,预期的功能都全部正常,当然所用于测试的SQL语句也大都比较简单,主要还是根据当前工作中遇到的一些SQL。
这次测试没有进行性能测试,等后面再找时间测试一下,不知道有没有哪位朋友已经做过了相应的性能测试没?性能测试之后就要开始规划应用到某些应用上面去了
原文地址:Amoeba For MySQL 功能测试让人满意, 感谢原作者分享。