Opening a database connection whenever required is a time consuming operation. To solve this problem we use connection pool. Connection pool maintains a number of open connections.
Initially the connection pool maintains a number of open connections specified by a configurable "minimum number of connections" value. When a new request for a connection comes, connection pool manager checks if the connection pool has any unused connection. If it finds an unused connection, it returns the connection to the caller. If all connections are busy, and the maximum pool size has not been reached, the new connection is created and added to the pool.
Assume the connection pool has the maximum number of open connections specified by a configurable "maximum number of connections" value. Now if a new connection request comes and if there is no free connection available, the request is queued up until a connection in the pool becomes available.
Connection pool increases the performance of Web applications by reusing the database connections instead of creating a new connection every time
Post Your Comment