File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes connection pooling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "connection pooling" Watch "connection pooling" New topic
Author

connection pooling

Sanjaykar Gurram
Greenhorn

Joined: May 05, 2008
Posts: 22
Hi all

take this scenario..

i am having maximum 100 connections(initial 50, increment=5,max=100) configured in my connection pool.
in the application runtime 100 users are already using the connections.
now the App. Server is not allowed to create another.

now my ques. is.. 101th user has come in, and he wants to do an urgent updation in the DB and he needs a connection.He cant wait b'coz
he is in a time bound application.in time he has to update his work, or else it is waste.

now how can the 101th user can get the connection?
what the application server is going to do in this scenario?
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4167
    
  21

The server doesn't know or care about request priority. It works on a first come, first served policy. It can't interrupt any current connections because that would break whatever the other users are doing and would leave the database in an unknown state. So it must wait for a connection and if this urgent request is the next in line, it will give it to him.

If you want to provide a priority-based connection system you will have to manage separate connection pools, reserving 1 or more connections for those high priority cases.


Steve
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60780
    
  65

A well-written application will hold connections for the shortest duration possible, so no one should have to wait very long for a connection. How long does your application hold onto connections?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Sanjaykar Gurram
Greenhorn

Joined: May 05, 2008
Posts: 22
Hi All

Thanks for your time.

Actually why i posted this in this forum is, i was asked this question by an interviewer. He told me this scenario and expected my answer.

yes, ofcourse a user doenst need a connection for a longer duration.
might be the interviewer wants to test me for a good answer.

Thanks
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Well yeah, usually.
 
jQuery in Action, 2nd edition
 
subject: connection pooling
 
Similar Threads
doubt regarding connection pooling
How do the connections get closed in Connection Pool
Throttling in weblogic8.1
Connection Pooling size
How to share a user-connection between two projects