In order to talk to a any database say Oracle, Mysql etc. we open up a database connection, execute the query or update and then close the connection. This opening and closing is resource intensive from CPU, Bandwidth and Memory perspective. This is specially important when there are lot such transactions are happening in parallel.
So in order to increase performance, we can create a pool of database connections, then each request can borrow the connection, use it for what it needed and finally return the connection back to the pool. In this way don’t keep on closing or opening the connection and reuse the already established connection from the pool.
The connection pool can be created using custom code or can be build using existing framework such as Apache Database Connection Pooling.
One of the most common issue associated with Pooling is Connection Pool Leak. It important to return the borrowed connection back to the pool else it would cause Connection Pool Leak and eventually the pool would be exhausted.