commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk Verbeeck <dirk.verbe...@pandora.be>
Subject Re: DBCP oracle connections less than minActive ?
Date Thu, 04 Dec 2003 22:26:08 GMT
see comments inline

Natarajan Arun wrote:

> First of all, Sorry for messing up the emails. By mistake I had my question
> posted in some other thread.
> 
> Thanks for responding John. It was a typo in the email i sent. I checked to
> make sure there was nothing wrong with the numbers passed:
>     connectionPool.setMaxActive(20);
>     connectionPool.setMinIdle(5);
>     connectionPool.setMaxIdle(20);
> Also the output shows
> getNumActive/getMaxActive 15/20 getNumIdle/getMaxIdle0/20.
> So, the getMaxActive does return 20. while at the same time Oracle does not
> seem to have that many connections.
All the min/max properties are static configuration settings, the 
getNumActive and getNumIdle are dynamic view of the pool status.
In your example there are currently 15 connections and the maximum 
number at any given time is 20. There are no connections available in 
the pool but there is room in the pool for a maximum of 20 idle 
connections.
In oracle you should see (getNumActive + getNumIdle) connections.

> The problem might have been that I was calling a static test method from a
> servlet, but was creating a pool object in the test method. That local pool
> object might have been cleaned up after the method execution was complete???
It is possible that your pool is garbage collected but you really 
should call close() when you have finished with a pool.

> Anyway, now I have cleaned all the mess and am trying to set proper values
> for my minIdle, maxIdle, maxActive and am a little confused even after
> reading explanations for these in the mail archives. Could someone confirm
> the following??
> 
>  + When i start my application I want to initially start up 's' connections.
> ==> setMinIdle(s)
setMinIdle is valid during the whole lifetime of the pool, it is a 
soft limit, the pool allocates extra connection in a background thread 
when the number of idle connections is below minIdle. You need to 
enable the evictor thread.

There is no property to "initially start up 's' connections".
You can make a feature request for this if you want.


>  + I never want the application to run out of connections.  ==> Do not set
> maxActive, or set it to some value and set
> connectionPool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_GROW)
I would always set a limit. The default action is to let the 
application wait until somebody else return a connection to the pool.
You can of course set a very high number of concurrent connections to 
the database.

>  + If during some peak time the number of connections go up to 'p', then I
> want to retain all of them for say the next 10 minutes, after which I want
> the number to go down back to 's' or whatever number is currently being
> used.
> 	==> connectionPool.setMinEvictableIdleTimeMillis(10*60*1000) OR
> connection.timeBetweenEvictionRunsMillis()
It will go down to "number is currently being used" + "minIdle(s)"

> I set s to be 5 and started my application in which I call a method that
> requests for 25 connections in a loop, not closing any of them. After the
> method call returns, I see 12 connections in oracle. Why 12 and not 25 that
> shud have been maintained ?
You should keep an array of Connections during your test, it is 
possible some of the Connections are garbage collected.

-- Dirk



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message