-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: c3p0 connections - unused connections are high
PostPosted: Sat Aug 07, 2010 1:18 pm 
Newbie

Joined: Sat Aug 07, 2010 1:04 pm
Posts: 1
We are using the following libraries:

hibernate-3.3.2.GA
c3p0-0.9.1.2
spring-2.5.5


Our spring context file looks like:

Code:
   <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
      <property name="driverClass"><value>${jdbc.driverClassName}</value></property>
      <property name="jdbcUrl"><value>${jdbc.url}</value></property>
      <property name="user"><value>${jdbc.username}</value></property>
      <property name="password"><value>${jdbc.password}</value></property>
      <property name="minPoolSize"><value>${c3p0.minPoolSize}</value></property>
      <property name="maxPoolSize"><value>${c3p0.maxPoolSize}</value></property>
      <property name="initialPoolSize"><value>${c3p0.initialPoolSize}</value></property>
      <property name="maxIdleTime"><value>${c3p0.maxIdleTime}</value></property>
      <property name="maxIdleTimeExcessConnections"><value>${c3p0.maxIdleTimeExcessConnections}</value></property>
      <property name="acquireIncrement"><value>${c3p0.acquireIncrement}</value></property>
      <property name="maxStatements"><value>${c3p0.maxStatements}</value></property>
      <property name="idleConnectionTestPeriod"><value>${c3p0.idleConnectionTestPeriod}</value></property>
      <property name="testConnectionOnCheckout"><value>false</value></property>
   </bean>


Our property file has these values:
Code:
# c3po settings
c3p0.minPoolSize=3
c3p0.maxPoolSize=20
c3p0.initialPoolSize=3
c3p0.maxIdleTime=60
c3p0.maxIdleTimeExcessConnections=30
c3p0.acquireIncrement=1
c3p0.maxStatements=2
c3p0.idleConnectionTestPeriod=3600


Our c3p0.properties file looks like:
Code:
c3p0.acquireRetryDelay=1000
c3p0.acquireRetryAttempts=60
c3p0.breakAfterAcquireFailure=false
c3p0.unreturnedConnectionTimeout=30
c3p0.debugUnreturnedConnectionStackTraces=true


Our log files shows:
Code:
searching for: StacAdmin - results size: 0
13:11:14,561 DEBUG GooGooStatementCache:297 - checkinAll(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 2; checked out: 0; num connections: 2; num keys: 2
13:11:14,561 DEBUG GooGooStatementCache:297 - checkinAll(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 2; checked out: 0; num connections: 2; num keys: 2
13:11:14,561 DEBUG BasicResourcePool:1644 - trace com.mchange.v2.resourcepool.BasicResourcePool@11fed16 [managed: 9, unused: 7 excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@13ff81c)
13:11:14,561 DEBUG GooGooStatementCache:297 - checkinAll(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 2; checked out: 0; num connections: 2; num keys: 2
13:11:14,561  INFO NrcdFileUploadServiceImpl:74 - runInProcessFiles() - size of results: 0
13:11:14,577 DEBUG BasicResourcePool:1644 - trace com.mchange.v2.resourcepool.BasicResourcePool@11fed16 [managed: 9, unused: 8, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@13ff81c)
13:11:14,577 DEBUG GooGooStatementCache:297 - checkinAll(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 2; checked out: 0; num connections: 2; num keys: 2


As you can see from the log file entries, the managed connections is 9 and unused 8. Prior to that the managed connections were 9 and unused 7. Why is the unused amount getting higher? The setting c3p0.maxIdleTimeExcessConnections=30 do clean up the unused connections, but shouldn't the connections be closed automatically after being used? I am using HibernateTemplate with HibernateCallback() so it should be managed.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.