commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryunix <>
Subject Re: [dbcp] RE: MaxActive and MaxIdle
Date Sun, 19 Apr 2009 04:29:07 GMT

Hi Phil,
Since you had mentioned about the active and idle connection in dbcp, do you
happen to know the reason why if I open the connection using 
'dbcp_datasource.getConnection()' and never call the connection.close(), the
particular connection will always been treated by dbcp as 'active


Phil Steitz wrote:
> wrote:
> Sorry for the delayed response.  Since this list is shared for all 
> commons components, it's best to prefix the subject line, as I have 
> changed it above, to include the component name.  See responses to your 
> questions below.
>> Hello,
>> I saw someone else ask this exact same question back in Dec but the reply
>> they received never really answered the question, so I thought I'd try
>> again.
>> I am using the dbcp included within Tomcat 5.5.27.
> So should be dbcp 1.2.2,  pool 1.4
>>   I configure it using
>> context.xml with: maxActive="30" maxIdle="10"
>> I always assumed that maxActive would limit the total amount of DB
>> connections that could ever be open at one time (in this case 30). 
> That is correct.
>>  Yet
>> from what I see it seems like I am limited to maxActive + maxIdle
>> connections open (in this case 40).  Is that true?
> No, maxActive should limit the total number of connections, idle in the 
> pool or checked out to clients.
>> Also, the default behavior seems to be that the connections never close
>> (or
>> timeout) within the pool when they are not being used. 
> Yes, the default behavior is not to validate or time out connections 
> while they are idle in the pool.  You can change this behavior by 
> setting timeBetweenEvictionRunsMillis and minEvictableIdleTimeMillis to 
> positive numbers.  The first of these determines how often (in 
> milliseconds) the "idle object evictor" runs and the second (also in 
> milliseconds) determines how long a connection can sit idle in the pool 
> before it is eligible for "eviction."
>>  I had my Tomcat
>> server sit there for about an hour idle with no client requests incoming
>> and when I ran netstat -a I still saw 39 connections open, they only
>> closed
>> when I killed Tomcat.  Do I have to turn on some kind of cleanup
>> explicitly?
> See comment above on timing out idle connections,  though be careful 
> about setting this too aggressively as it can lead to connection churn.  
> The number of open connections - 39 - looks too large for the maxActive 
> setting above.   Are you sure all of the connections were opened by the 
> connection pool?
> Phil
>> thanks!
>> --------------------------------------------------------------------
>> - Premium Microsoft® Windows® and Linux web and application
>> hosting -
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> For additional commands, e-mail:
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View this message in context:
Sent from the Commons - User mailing list archive at

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

View raw message