I don't know whether this is right place to post this question or not.
I am using connection pooling in Tomcat6.0.18, i am using <resource> element to configure for connection pooling and its working fine.
My doubt is, is there any configuration can be done, for increasing the number of connection dynamically in the Pool.
For example, if the available connection is 10 and all the 10 available connections are busy, can i configure to increase the pool size by 10 each time when all the connections are busy. At the same time the number of connections is not used means it should reduce to the minimum number of connection in the pool.
I don't know whether this facility is available in Connection pooling or not. Please solve my problem.
This would depend on which connection pooler you use. If my memory isn't too far off, the Apache DBCP pooler, which is the one that's shipped with Tomcat has a set of parameters that determine baseline and max connection counts. Connects are acquired on demand, not in batches, since while getting a connection is fairly expensive, there's no benefit in attempting to acquire more than one at a time. That is, if you ask for 8 connections at once, it will take 8 times as long as it does to open just one connection.
For a complete rundown on the options for DBCP, check the Tomcat docs on connection pools and the apache commons docs on Apache DBCP itself.
If you REALLY wanted to, you could create a custom connection pooler, but I don't advise doing this kind of stuff lightly. It can adversely impact every app in your Tomcat server if you don't get everything meticulously correct.
An IDE is no substitute for an Intelligent Developer.
Joined: Jun 19, 2008
Hi Tim Holloway,
Thank you for your reply...
I think you didn't understand my question, my problem is, I need to configure the web-application so that the connection in the pool must increment if there is no connection available for the coming request.
Example. this is rough example dont consider this in real suitation.
assume the connection is not closed in a method, then after some time the request will not be responded, since there is no connection available in pool. at this point of time is it possible to increase the pool size by say 10 connection.