Friday, April 27, 2001 01:09 PM
Instead of opening a new connection to the database everytime the application need it, you can create a "pool" of 100 (or more) connection and keep them opened while your App is running.
When a connection is needed you can take one of the opened ones and use it.
After a connection is used, instead to close it, it will be simply "released" to the pool and make it aivable for other tasks.
To get an aivable connection from the pool you can choose different algorithm to tune for performances: you can simpy traverse the pool looking for the first aivable, and start from the fist connection when the last has been reached (Round Robin) or get one randomly in the pool, checking if it's aivable before use.
It's not difficult to implement a connection pool, but it can speed up a lot your application specially if it's a web application with multiple tasks and user at time.