This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Connection Pooling Doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Connection Pooling Doubt" Watch "Connection Pooling Doubt" New topic
Author

Connection Pooling Doubt

Bennet Xavier
Ranch Hand

Joined: Jun 19, 2008
Posts: 162
Hi All,

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.

Thanks In Advance.

Bennet Xavier. X

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15952
    
  19

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Bennet Xavier
Ranch Hand

Joined: Jun 19, 2008
Posts: 162
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.

Like the StringBuffer which increments it size if the string size increases...

Thanks and Rregards
Bennet Xavier. X
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Connection Pooling Doubt
 
Similar Threads
Connection Pooling
Doubt in closing connection, resultset, statemnet object???
Doubt in Connection Pooling
Help!!!!!! how to set Connection Pooling
Connection Pooling