Reputation: 51
I have a basic c3p0 configuration as below. What I am asking is when there is no traffic on the application (connections stay idle), could c3p0 shrink the pool when maxIdleTime is reached for each connection since min and max connection numbers are the same?
<property name="driverClass" value="oracle.jdbc.driver.OracleDriver"/>
<property name="jdbcUrl" value="#[jdbc.url]"/>
<property name="user" value="#[jdbc.username]"/>
<property name="password" ref="DbPassword"/>
<property name="minPoolSize" value=25/>
<property name="maxPoolSize" value=25/>
<property name="acquireIncrement" value= 1/>
<property name="idleConnectionTestPeriod" value="100"/>
<property name="maxIdleTime" value="120"/>
<property name="preferredTestQuery" value ="select 1 from dual"/>
Upvotes: 1
Views: 2126
Reputation: 3154
maxIdleTimeExcessConnections
is about minimizing the number of Connections held by c3p0 pools when the pool is not under load. By default, c3p0 pools grow under load, but only shrink if Connections fail a Connection test or are expired away via the parameters described above. Some users want their pools to quickly release unnecessary Connections after a spike in usage that forces a large pool size. You can achieve this by setting maxIdleTimeExcessConnections
to a value much shorter than maxIdleTime
, forcing Connections beyond your set minimum size to be released if they sit idle for more than a short period of time.
Upvotes: 1