Dec 16, 2010

Database connection pooling

Databases are the most common storing technology in todays IT world. Most of IT related things such as softwares and websites store data in a database. Database integration in a system got many advantages but there are some disadvantages also.
The main disadvantage is it require some time to retrieve or to store data. The database is an external thing from the software or the website. So first software or the website must make a connection to the database. This connection establishment require 1 to 3 seconds of time. Then it must send the query to retrieve data or to store data in the database. And then it should close the connection properly. This time requirement is an over head to the system. If the system is used by a large number of people this will make a huge impact.
So to avoid this, we can use a pool of connections. The pool will keep some database connections alive without disconnecting it from the database. Then, if the system request a database connection it will give one of its live connection to the request. While it in use there may be another request also. Then again pool will release another live connection to that. Now the systems does not need to make connections to the database, its almost done by the database pool. So that time requirement goes down.
But there are some limitations with the database pools also. Pool contains a limited number of connections but that may reduce performance issues. The programmer or the system designer must do additional work to use a database pool and he/she should think how to manage it. Mainly how to handle the maximum number of connections, connection queues, priority based connections and so on. There are many library files which can be used like c3p0.
So now we can have a good integrated system with good performances.  

No comments:

Post a Comment

Your comments are always welcome ...