<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation=
         "http://www.springframework.org/schema/beans 
          http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

  <bean id="dataSource" destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName" value="${db.driver}"/>
    <property name="url" value="${db.jdbcurl}"/>
    <property name="username" value="${db.username}"/>
    <property name="password" value="${db.password}"/>
    <property name="defaultAutoCommit" value="false"/>
    
    <!-- connection pool props -->
    <property name="initialSize" value="50"/>
    <!-- <property name="maxActive" value="20"/> the default is 8, which should be enough for the initial release. -->
    <!-- the following properties configure the connection pool for handling the freshness of the connections it returns -->
    <property name="maxActive" value="150"/>
    <property name="validationQuery" value="SELECT 1" />
    <property name="testWhileIdle" value="true" />
    <property name="timeBetweenEvictionRunsMillis" value="3600000" />
    <property name="minEvictableIdleTimeMillis" value="14400000" />
  </bean>

</beans>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation=
         "http://www.springframework.org/schema/beans 
          http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

  <bean id="dataSource" destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName" value="${db.driver}"/>
    <property name="url" value="${db.jdbcurl}"/>
    <property name="username" value="${db.username}"/>
    <property name="password" value="${db.password}"/>
    <property name="defaultAutoCommit" value="false"/>
    
    <!-- connection pool props -->
    <property name="initialSize" value="8"/>
    <!-- <property name="maxActive" value="20"/> the default is 8, which should be enough for the initial release. -->
    <!-- the following properties configure the connection pool for handling the freshness of the connections it returns -->
    <property name="maxActive" value="8"/>
    <property name="validationQuery" value="SELECT 1" />
    <property name="testWhileIdle" value="true" />
    <property name="timeBetweenEvictionRunsMillis" value="3600000" />
    <property name="minEvictableIdleTimeMillis" value="14400000" />
  </bean>

</beans>
Set the maximum number of active database connections.
Set the maximum number of active database connections.

This number was determined after a series of tests. Increasing it to 16 had similar results but increased slightly quicker than at 8. This is directly related to the number of active threads in MySQL and may not be optimal for configurations where more memory is available and would especially not be optimal if we began using a MySQL cluster.
