Now common open source database connection pool mainly has c3p0, DBCP, proxool three kinds, among them:
Spring recommends the use of DBCP;
Hibernate recommends the use of c3p0 and proxool;
1, Dbcp:apache
DBCP (Database connection pool) DB connection pool. is a Java Connection pool project on Apache and a connection pool component used by Tomcat. Use of DBCP alone requires 3 packages: Common-dbcp.jar,common-pool.jar, Common-collections.jar because establishing a database connection is a very time-consuming and resource-intensive behavior, the connection pool is pre-established with the database to make some connections, put in memory, the application needs to establish a database connection directly to the connection pool to apply for a line, run out and then put back. The DBCP does not automatically recycle the idle connection function.
2, C3P0:
C3P0 is an open source JDBC connection pool that implements the data source and Jndi bindings, and supports the standard extensions of the JDBC3 specification and JDBC2. C3P0 are asynchronous operations, and slow JDBC operations are done by helping the process. Extending these operations can effectively improve performance. The open source projects that currently use it are hibernate,spring and so on. The C3P0 has auto-recycle idle connection function.
3, Proxool:sourceforge
Proxool is a Java database connection pooling technique. is an open source project under SourceForge, this project provides a robust, easy-to-use connection pool, the most critical of which is the ability to provide monitoring, easy to use, easy to find the connection leakage situation.
Contrast:
1> the same amount of threads and cycles in the same time: compare the three iconic performance test parameters (Average,median,90%line) for three connection pools and discover: Performance dbcp<=c3p0<proxool;
2> test of the same database connection pool under different circumstances: by observing the Average,median,90%line three parameters, a
Now the stability of three connection pools (the change of three test parameters of three connection pools) in order: stability Dbcp>=c3p0>proxool.
Conclusion:
By testing the performance of three database connection pools, Proxool and c3p0 are better able to support high concurrency, but the stability is slightly inferior to DPCP;
Common Database Connection Pools