commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk Verbeeck <>
Subject Re: [DBCP] Timeout for creating a new connection
Date Sat, 20 Sep 2003 13:19:57 GMT
What version of DBCP/pool are you using? Configuration parameters?

The 'huge number of connections' can be limited with the maxActive 
This should be enough to control a system under permanent high load.

If you are experiencing usage peaks (from 10 active to 100 and back to 
10) then there are currently already some options.
When you don't have a maxIdle configured then the connections remain in 
the pool ready for the next peak, this is the simplest way.

The grow rate isn't controlled. It is only limited by the synchronized 
makeObject() in PoolableConnectionFactory. (one new connection at a time)
In our example all 90 connections will be created. All threads will 
block on makeObject() and will not notice when a connection becomes 

If you don't want a lot of idle connections in your pool but also have a 
lot of usage peaks then you should consider using the "evictor" feature.
Using the timeBetweenEvictionRunsMillis, numTestsPerEvictionRun and 
minEvictableIdleTimeMillis, you can control the rate the connections are 
removed from the pool and this helps against multiple usage peaks while 
still reducing the idle connections under moderate/low usage.

Already some options are available as you can see, all depends on the usage.

But there is still room for improvements, your idea to wait before 
growing can be usefull.
Removing the synchronized makeObject and letting the pool control the 
grow rate is would also be nice.

If you can make a performance test that simulates your pool usage then 
we can do some finetuning.


Todd Carmichael wrote:

>After some snooping I see that some of the functionality that I need is not
>in dbcp but in the commons pool library.  But it is not exactly what I want.
>There is a max wait paramter but it only works for when_exhausted_block
>setting.  I want the wait to work in when_exhausted_grow mode.  So if I
>wait, and there is still no connection available, create a new one.  
>-----Original Message-----
>From: Todd Carmichael [] 
>Sent: Friday, September 19, 2003 11:30 AM
>To: 'Jakarta Commons Users List'
>Subject: [DBCP] Timeout for creating a new connection
>I am interested in a setting that if the db pool is exhausted, then the code
>will wait a certain amount of time for a new object to appear available in
>the pool.  Our problem is that under load, the system ends up creating a
>huge number of connections.  Creating a new connection in MS SQL Server is a
>huge performance and scalability hit.  If the code could wait a 100-500 ms,
>then a connection most likely become available.  This would definitely be a
>configuration parameter.  Is this functionality available or should I just
>patch the code myself?
>Todd Carmichael
>To unsubscribe, e-mail:
>For additional commands, e-mail:
>To unsubscribe, e-mail:
>For additional commands, e-mail:

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

View raw message