|
Database Connection Pooling by Charles Carroll
Connection pooling takes care of re-using
connections.
Lets say Scripta.asp
- creates a connection
- process data
- close connection, set to nothing
and 1,000 users do this simultaneously. It is not
quite simultaneous, let us say that what happens when eight users access a
script and create, close and destroy eight connections.
| User |
Open conn. time |
Process Start time |
Close time |
| #1 |
1:00am .001 |
1:00am .002 |
1:00am .012 |
| #2 |
1:00am .002 |
1:00am .003 |
1:00am .013 |
| #3 |
1:00am .003 |
1:00am .004 |
1:00am .009 |
| #4 |
1:00am .003 |
1:00am .004 |
1:00am .015 |
| #5 |
1:00am .007 |
1:00am .008 |
1:00am .014 |
| #6 |
1:00am .009 |
1:00am .010 |
1:00am .021 |
| #7 |
1:00am .016 |
1:00am .017 |
1:00am .028 |
| #8 |
1:00am .017 |
1:00am .018 |
1:00am .026 |
|
|
|
|
| Time - open conns |
Open conns |
Pool to be reused |
Being Re-used |
| 1:00am .001 - 1 |
#1 |
0 |
|
| 1:00am .002 - 2 |
#1, #2 |
0 |
|
| 1:00am .010 - 4 |
#1, #2, #4, #5, #6 |
#3 |
|
| 1:00am .013 - 4 |
#2, #4, #5, #6 |
#1 |
#6 using #3 |
| 1:00am .014 - 3 |
#4, #5, #6 |
#1, #2 |
|
| 1:00am .016 - 2 |
#6, #7 |
#2, #4 |
#7 using #1 |
| 1:00am .022 - |
#7, #8 |
#1, #3, #4, #5 |
#8 using #2 |
| 1:00am .027 - |
#7 |
#1, #3, #4, #5 |
|
| 1:00am .029 - |
|
#1, #3, #4, #5 waiting |
|
Because of connection pooling they will use MUCH less than 1,000 brand new
connections as conn.open statements will be provided with already existing
connections invisibly PROVIDING they were closed and thus guaranteed available
for re-use.
The pool connections can only be re-used if they are closed. They expire in
sixty seconds by default. This is all explained in the following articles:
 |  |  |
 |
There are many worthy charities!!. But perhaps help starving children in Africa or South America AND help Charles too.
a $5 tip buys him lunch at McDonalds,
a $20 tip buys his kid Hitoshi a new computer game,
a $39 tip buys his daughter Michiko a few nice outfits.
See our donor list.
|  |
 |  |  |
|
|
|
|