commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <>
Subject [dbcp] DBCP minIdle, maxIdle
Date Sun, 11 Jul 2010 13:02:38 GMT
Jan C. wrote:
> Hello,
> I'm using apache DBCP and I'm not sure what values for those setting I
> should chose in a productive environment. If I understand correctly,
> when the application releases a connection and maxIdle is not yet
> reached, the connection will stay opened and idle in the pool.

> Now if the application needs another connection, will one of the idle
> be given to the app or a new one opened ?

If there are idle connections in the pool when an application
requests a connection, one of the idle ones will be returned.

 What does it bring to keep
> opened idle connections ?

I am not sure what you mean here.  If what you mean is what does
DBCP do to make sure that idle connections in the pool remain open,
the answer is by default, nothing. See the documentation on
timeBetweenEvictionRunsMillis, testWhileIdle and
numTestsPerEvictionRun for instructions on how to get idle
connections periodically tested.  Look at the web page or the class
javadoc for BasicDataSource.

 Is there a maxActive/maxIdle ratio that
> should be respected ?

Not sure exactly what you mean here.  If maxActive is much larger
than maxIdle and load fluctuates, you can end up with a lot of
physical close/open operations.  On the other hand, if maxActive =
maxIdle and the bound is attained but only rarely, the pool will
hold onto more connections than it needs.  The best settings depend
on load patterns and how important it is in your environment to
conserve physical database connections.

> Thanks,
> Jan
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message