title: How is maxIdleTimeExcessConnections different from maxIdleTime in c3p0?
body: <p>I want to configure my c3p0 connection pool so that at least 2 connections are always active, at most 5, and idle connections past the first 2 will expire in a reasonable amount of time (say an hour).</p>
  
  <p>This all sounds straightforward except the documentation seems to imply that there is no difference between the functions <code>maxIdleTime</code> and <code>maxIdleTimeExcessConnections</code>, which is confusing me.</p>
  
  <p><a href="http://www.mchange.com/projects/c3p0/#basic_pool_configuration">Basic pool configuration</a> states:</p>
  
  <blockquote>
    <p>Within the range between minPoolSize and maxPoolSize, the number of Connections in a pool varies according to usage patterns. The number of Connections increases whenever a Connection is requested by a user, no Connections are available, and the pool has not yet reached maxPoolSize in the number of Connections managed. Since Connection acquisition is very slow, it is almost always useful to increase the number of Connections eagerly, in batches, rather than forcing each client to wait for a new Connection to provoke a single acquisition when the load is increasing. acquireIncrement determines how many Connections a c3p0 pool will attempt to acquire when the pool has run out of Connections. (Regardless of acquireIncrement, the pool will never allow maxPoolSize to be exceeded.)</p>
  </blockquote>
  
  <p>And <code>minPoolSize</code> usage:</p>
  
  <blockquote>
    <p>Minimum number of Connections a pool will maintain at any given time.</p>
  </blockquote>
  
  <p>Okay, great. And for configuring connection time:</p>
  
  <blockquote>
    <p>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.</p>
  </blockquote>
  
  <p>So it's implied that <code>minPoolSize</code> only matters when used in conjunction with <code>maxIdleTimeExcessConnections</code>, otherwise, it'll just be ignored entirely.</p>
  
  <p>Corroborating the documentation for <code>maxIdleTime</code> makes no mention of <code>minPoolSize</code>:</p>
  
  <blockquote>
    <p>Seconds a Connection can remain pooled but unused before being discarded. Zero means idle connections never expire.</p>
  </blockquote>
  
  <p>And <code>maxIdleTimeExcessConnections</code> makes sense:</p>
  
  <blockquote>
    <p>Number of seconds that Connections in excess of minPoolSize should be permitted to remain idle in the pool before being culled. Intended for applications that wish to aggressively minimize the number of open Connections, shrinking the pool back towards minPoolSize if, following a spike, the load level diminishes and Connections acquired are no longer needed. If maxIdleTime is set, maxIdleTimeExcessConnections should be smaller if the parameter is to have any effect. Zero means no enforcement, excess Connections are not idled out.</p>
  </blockquote>
  
  <p>I find it really odd that <code>minPoolSize</code>, a basic feature, only matters when used with what seems to me to be a more advanced feature. Is this all correct?</p>