Natarajan Arun wrote:
All the min/max properties are static configuration settings, the getNumActive and getNumIdle are dynamic view of the pool status.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.
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.
It is possible that your pool is garbage collected but you really should call close() when you have finished with a pool.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???
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.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)
There is no property to "initially start up 's' connections". You can make a feature request for this if you want.
I would always set a limit. The default action is to let the application wait until somebody else return a connection to the pool.+ 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)
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)"You should keep an array of Connections during your test, it is possible some of the Connections are garbage collected.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 ?
-- Dirk
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
