Hi,
I am using Hibernate 3.1.3, Spring and MySQL 5. I am trying to implement connection pooling but it seems that the number of connections is always capped at 10. I have checked my MySQL configuration and the maximum number of connections allowed is 100, and there is no limit to user connections.
I tried connection pooling with dbcp and c3p0 alternatively, but I still hit the limit of 10 no matter how I configure the initial or minimum pool sizes. By the way, I found out about this limit when I was doing load testing with JMeter. I'm pretty sure the bottleneck is at the data access layer, because even when I replace a data-intensive jsp page with a minimal data jsp page, I still get the throughput limited at 10 requests per second.
I can't figure out where this limit is being set, and would really appreciate if someone could help!
Here is my configuration:
<!-- DHCP datasource (commented out)
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost/xxx"/>
<property name="username" value="xxx"/>
<property name="password" value="xxx"/>
</bean>
-->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass" value="com.mysql.jdbc.Driver"/>
<property name="jdbcUrl" value="jdbc:mysql://localhost/xxx"/>
<property name="user" value="xxx"/>
<property name="password" value="xxx"/>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="mappingResources">
<list>
<value>...</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</prop>
<prop key="hibernate.cglib.use_reflection_optimizer">false</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.use_sql_comments">true</prop>
<prop key="hibernate.generate_statistics">false</prop>
<prop key="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.OSCacheProvider</prop>
<prop key="hibernate.current_session_context_class">thread</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.c3p0.max_size">80</prop>
<prop key="hibernate.c3p0.min_size">20</prop>
<prop key="hibernate.c3p0.initial_pool_size">20</prop>
<prop key="hibernate.c3p0.min_pool_size">15</prop>
<prop key="hibernate.c3p0.max_pool_size">25</prop>
<prop key="hibernate.c3p0.timeout">1800</prop>
<prop key="hibernate.c3p0.max_statements">50</prop>
<!--
<prop key="hibernate.dbcp.maxActive">2</prop>
<prop key="hibernate.dbcp.maxIdle">2</prop>
<prop key="hibernate.dbcp.maxWait">120000</prop>
<prop key="hibernate.dbcp.whenExhaustedAction">1</prop>
<prop key="hibernate.dbcp.testOnBorrow">true</prop>
<prop key="hibernate.dbcp.testOnReturn">true</prop>
<prop key="hibernate.dbcp.validationQuery">
select 1;
</prop>
<prop key="hibernate.dbcp.ps.maxActive">5</prop>
<prop key="hibernate.dbcp.ps.maxIdle">5</prop>
<prop key="hibernate.dbcp.ps.maxWait">180000</prop>
<prop key="hibernate.dbcp.ps.whenExhaustedAction">2</prop>
-->
</props>
</property>
</bean>
|