Benefits of Connection Pooling
By Ramakrishna on Oct 27, 2008 in Connection Pooling Benifits
Benefits of Connection Pooling:
Connection pooling can greatly increase the performance of your Java application, while reducing overall resource usage. The main benefits to connection pooling are:
Reduced connection creation time:
While this is not usually an issue with the quick connection setup that MySQL offers compared to other databases, creating connections still has networking and JDBC driver overhead that will be avoided if connections are “recycled.”
Simplified programming model:
When using connection pooling, each individual thread can act as though it has created its own JDBC connection, allowing you to use straight-forward JDBC programming techniques.
Controlled resource usage:
If you don’t use connection pooling, and instead create a new connection every time a thread needs one, your application’s resource usage can be quite wasteful and lead to unpredictable behavior under load.
Remember that each connection to MySQL has overhead (memory, CPU, context switches, etc) on both the client and server side. Every connection limits how many resources there are available to your application as well as the MySQL server. Many of these resources will be used whether or not the connection is actually doing any useful work!
Connection pools can be tuned to maximize performance, while keeping resource utilization below the point where your application will start to fail rather than just run slower.
