[b]maven pom.xml设置:[/b]
[b]spring dataSource Bean:设置[/b]
[b]机器环境:[/b]
[img]http://dl.iteye.com/upload/attachment/0068/7876/a77620b6-4132-3d6f-a92f-a4bdd1621e54.jpg[/img]
[b]测试结果:[/b]
[img]http://dl.iteye.com/upload/attachment/0068/7878/a8dc5793-d492-353f-acb6-93c127a31e62.jpg[/img]
[b]从现有测试结果来看,tomcat pool略好于BoneCP。另外,tomcat pool使用两个线程各10000条记录,处理的时间与单线程相当;开10个线程各10000条记录时,各线程处理时间在60~63秒之间。[/b]
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
<version>7.0.25</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-juli</artifactId>
<version>7.0.25</version>
</dependency>
<dependency>
<groupId>com.jolbox</groupId>
<artifactId>bonecp</artifactId>
<version>0.7.1.RELEASE</version>
</dependency>
[b]spring dataSource Bean:设置[/b]
<bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource" destroy-method="close"
p:driverClassName="oracle.jdbc.driver.OracleDriver"
p:url="jdbc:oracle:thin:@61.155.156.174:1521:paydb"
p:username="sn_olts"
p:password="sn_olts"
p:initialSize="10"
p:maxActive="50"
p:maxWait="-1"
p:maxIdle="3"
p:minIdle="3"/>
<bean id="dataSource" class="com.jolbox.bonecp.BoneCPDataSource"
destroy-method="close"
p:driverClass="oracle.jdbc.driver.OracleDriver"
p:jdbcUrl="jdbc:oracle:thin:@61.155.156.174:1521:paydb"
p:username="sn_olts"
p:password="sn_olts">
<!-- 检查数据库连接池中空闲连接的间隔时间 -->
<property name="idleConnectionTestPeriodInMinutes" value="60" />
<!-- 连接池中未使用的链接最大存活时间 -->
<property name="idleMaxAgeInMinutes" value="240" />
<!-- 设置每个分区含有connection最大个数 -->
<property name="maxConnectionsPerPartition" value="50" />
<!-- 设置每个分区含有connection最小个数 -->
<property name="minConnectionsPerPartition" value="10" />
<!-- 设置每个分区数 -->
<property name="partitionCount" value="3" />
<!-- 设置分区中的connection增长数量 -->
<property name="acquireIncrement" value="5" />
<!-- 设置连接池阀值 -->
<property name="poolAvailabilityThreshold" value="10"/>
<!-- 连接时间 -->
<property name="connectionTimeoutInMs" value="1"/>
<property name="statementsCacheSize" value="100"/>
<property name="releaseHelperThreads" value="3"/>
</bean>
[b]机器环境:[/b]
[img]http://dl.iteye.com/upload/attachment/0068/7876/a77620b6-4132-3d6f-a92f-a4bdd1621e54.jpg[/img]
[b]测试结果:[/b]
[img]http://dl.iteye.com/upload/attachment/0068/7878/a8dc5793-d492-353f-acb6-93c127a31e62.jpg[/img]
[b]从现有测试结果来看,tomcat pool略好于BoneCP。另外,tomcat pool使用两个线程各10000条记录,处理的时间与单线程相当;开10个线程各10000条记录时,各线程处理时间在60~63秒之间。[/b]