Connection Pool
Encyclopedia
In software engineering
,
a connection pool is a cache
of database connection
s maintained so that the connections can be reused when future requests to the database are required.
Connection pools are used to enhance the performance of executing commands on a database. Opening and maintaining a database connection for each user, especially requests made to a dynamic database-driven website
application, is costly and wastes resources. In connection pooling, after a connection is created, it is placed in the pool and it is used over again so that a new connection does not have to be established. If all the connections are being used, a new connection is made and is added to the pool. Connection pooling also cuts down on the amount of time a user must wait to establish a connection to the database.
. Any dynamic web page
can be coded to open a connection and close it normally but behind the scenes when a new connection is requested, one is returned from the connection pool maintained by the application server. Similarly, when a connection is closed it is actually returned to the connection pool.
Connection pooling is not limited to using application servers. Traditional applications that need frequent access to databases can benefit from connection pooling as well. This was traditionally handled by manually maintaining database connections, but as expected, that meant very well-crafted programming as the framework for pooling is highly complex. In recent years, things have become a lot easier due to availability of third-party libraries that allow connection pooling as well as SQL statement pooling, thus giving high performance in database intensive applications.
Various parameters such as number of minimum connections, maximum connections and idle connections can be set to make sure the connection pool works well according to the environment it is deployed to work in.
, Microsoft SQL Server
, Oracle
., MySQL
and PostgreSQL
Software engineering
Software Engineering is the application of a systematic, disciplined, quantifiable approach to the development, operation, and maintenance of software, and the study of these approaches; that is, the application of engineering to software...
,
a connection pool is a cache
Cache
In computer engineering, a cache is a component that transparently stores data so that future requests for that data can be served faster. The data that is stored within a cache might be values that have been computed earlier or duplicates of original values that are stored elsewhere...
of database connection
Database connection
A database connection is a facility in computer science that allows client software to communicate with database server software, whether on the same machine or not. A connection is required to send commands and receive answers....
s maintained so that the connections can be reused when future requests to the database are required.
Connection pools are used to enhance the performance of executing commands on a database. Opening and maintaining a database connection for each user, especially requests made to a dynamic database-driven website
Website
A website, also written as Web site, web site, or simply site, is a collection of related web pages containing images, videos or other digital assets. A website is hosted on at least one web server, accessible via a network such as the Internet or a private local area network through an Internet...
application, is costly and wastes resources. In connection pooling, after a connection is created, it is placed in the pool and it is used over again so that a new connection does not have to be established. If all the connections are being used, a new connection is made and is added to the pool. Connection pooling also cuts down on the amount of time a user must wait to establish a connection to the database.
Applications
Connection pooling being normally used in web-based and enterprise applications is usually handled by an application serverApplication server
An application server is a software framework that provides an environment in which applications can run, no matter what the applications are or what they do...
. Any dynamic web page
Dynamic web page
A dynamic web page is a kind of web page that has been prepared with fresh information , for each individual viewing. It is not static because it changes with the time , the user , the user interaction , the context A dynamic web page is a kind of web page that has been prepared with fresh...
can be coded to open a connection and close it normally but behind the scenes when a new connection is requested, one is returned from the connection pool maintained by the application server. Similarly, when a connection is closed it is actually returned to the connection pool.
Connection pooling is not limited to using application servers. Traditional applications that need frequent access to databases can benefit from connection pooling as well. This was traditionally handled by manually maintaining database connections, but as expected, that meant very well-crafted programming as the framework for pooling is highly complex. In recent years, things have become a lot easier due to availability of third-party libraries that allow connection pooling as well as SQL statement pooling, thus giving high performance in database intensive applications.
Various parameters such as number of minimum connections, maximum connections and idle connections can be set to make sure the connection pool works well according to the environment it is deployed to work in.
Database support
Connection pooling is supported by IBM DB2IBM DB2
The IBM DB2 Enterprise Server Edition is a relational model database server developed by IBM. It primarily runs on Unix , Linux, IBM i , z/OS and Windows servers. DB2 also powers the different IBM InfoSphere Warehouse editions...
, Microsoft SQL Server
Microsoft SQL Server
Microsoft SQL Server is a relational database server, developed by Microsoft: It is a software product whose primary function is to store and retrieve data as requested by other software applications, be it those on the same computer or those running on another computer across a network...
, Oracle
Oracle Database
The Oracle Database is an object-relational database management system produced and marketed by Oracle Corporation....
., MySQL
MySQL
MySQL officially, but also commonly "My Sequel") is a relational database management system that runs as a server providing multi-user access to a number of databases. It is named after developer Michael Widenius' daughter, My...
and PostgreSQL
PostgreSQL
PostgreSQL, often simply Postgres, is an object-relational database management system available for many platforms including Linux, FreeBSD, Solaris, MS Windows and Mac OS X. It is released under the PostgreSQL License, which is an MIT-style license, and is thus free and open source software...