commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject RE: DBCP Configuration Question
Date Mon, 22 Aug 2011 13:31:56 GMT
Hi Phil,

Thank you for your response.  What would you recommend these settings would be?  I was think
15 to 20 minutes.

> timeBetweenEvictionRunsMillis
> minEvictableIdleTimeMillis

-----Original Message-----
From: Phil Steitz [] 
Sent: Friday, August 19, 2011 3:49 PM
To: Commons Users List
Subject: Re: DBCP Configuration Question

On 8/19/11 1:06 PM, wrote:
> Hi Everyone,
> What is the best way to config the commons DB connection pools to ensure there are not
any stale/bad connections?
These comments refer to 1.x versions of DBCP.

The simplest way is to set testOnBorrow to true and set up a validation query.  If your app
holds connections long enough for them to go bad before they get returned (generally a bad
idea) you can also set testOnReturn to true.  These settings, with a validation query, cause
the pool to test the connections on the way
out / in to the idle instance pool.   You can also use the pool
maintenance thread to "evict" connections that have been idle in the pool too long or to test
them periodically; but the first option
(testOnBorrow) is usually sufficient.
> Also, is there any relation between these 2 groups of parameters?
> timeBetweenEvictionRunsMillis
> minEvictableIdleTimeMillis
> removeAbandoned
> removeAbandonedTimeout

Not really.  The first set of parameters control the behavior of the pool's maintenance thread.
 The second control  "abandoned"
connection tracking and cleanup.  Abandoned connection cleanup is triggered by connection
requests and is not effected by the maintenance thread settings.

> Thank you for your help,
> Jeff

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

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

View raw message