Hi,
We have developed a web application using the following technologies
hibernate 3
struts
spring
mysql
tomcat
The system has currently been deployed. I have a question regarding the dataSource connection pooling. As can be seen in the spring configuration below, there is no maxActive specified in the dataSource bean definition, and the value of the hibernate.dbcp.maxActive property has been set to 30 in the sessionFactory bean.
I am displaying the values of the dataSource variables on the screen and I see that the maxActive is showing a value of 8. My questions are:
1. Will the hibernate property overwrite this value? Or do I need to set the maxActive in the dataSource bean definition to 30 in order to set hibernate's value to 30?
2. Can someone tell me what the "best practices" values are for the db pooling properties (max active, maxWait, etc)? Is 8 the default for "maxActive", and does this not seem too low?
Thanks,
-Riz.
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${hibernate.connection.driver_class}" />
<property name="url" value="${hibernate.connection.url}" />
<property name="username" value="${hibernate.connection.username}" />
<property name="password" value="${hibernate.connection.password}" />
</bean>
<!-- Hibernate SessionFactory -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="mappingDirectoryLocations">
<list>
<value>classpath:com/cwsi/eshipper/model</value>
<value>classpath:com/cwsi/eshipper/carrier/purolator/model</value>
<value>classpath:com/cwsi/eshipper/carrier/cws/model</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
${hibernate.dialect}
</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.generate_statistics">true</prop>
<prop key="hibernate.dbcp.maxActive">30</prop>
<prop key="hibernate.dbcp.whenExhaustedAction">20</prop>
<prop key="hibernate.dbcp.maxWait">${hibernate.connection.maxWait}</prop>
<prop key="hibernate.dbcp.maxIdle">10</prop>
</props>
</property>
<property name="eventListeners">
<map>
<entry key="merge">
<bean class="org.springframework.orm.hibernate3.support.IdTransferringMergeEventListener" />
</entry>
</map>
</property>
</bean>
|