• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

connection pooling

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have following questions about connection pooling ---

1. if the server sets an initial connection number as 10 in the pool, then what if there are 11 requests coming in, each needs a connection ? Certainly the first 10 requests will use the 10 connections in the pool, then how about the 11th request ? When it finds that the 10 connection are all being used, does it need to wait until one of the 10 requests is done and returns the connection back to pool ? or, will the server automatically create a separate new connection for this 11th request ?

2. after a request finishes using the connection and returns it to pool, will the server keep this connection forever (as long as the server is alive) in the pool so that it can be used by any new request ? or will the server kills the connection after the connection is idle for a certainly amount of time ?
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
this question deserve a detailed answer. hmmmmm

- the connection pool always have some no of connections, always. as you mentioned it 10. you can say it as initial size.

- if all connection are in use by a no of requests, then there is a mechanism which will increase the pool with an extent, say 5. it means if all connection objects are busy the pool definitely increase but by 5 because if it increase just by 1 then there would be a definite chance to make another connection soon. thus it will make 5 connections when increase. and so on.

- but again there would be a maxsize defined, say 30 then if the pool size is already 30 then the new request must wait for sometime.

- after getting some no of connections back it will destroy some connection objects which were made on need basis. say there is 10 objects in the pool all gets busy. on new request the pool increases by 5. now there is 15 no of connections. say 12 is in use and 3 are there for coming requests. but no request are made and 8 connections are back. then it will destroy 5 connections which were made on need basis and still have 6 there in the pool. and if the remaining connection would come be back then it would gain all 10 connections which was the starting no.

- yes, pool should takecare about the stale connections. it can handle it by some mechanism.

i tried my best to give you the idea. please appreciate

cheers.
 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The only thing that needs adding is that the details can vary from pool implementation to implementation. Some might even give you a choice of different policies.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic