Tomcat has introduced a Connection Pool lately, I think from version 7.25.
Is there a way to use this pool with earlier versions? i wonder if a separate jar could be downloaded. The problem is most hosting sites are not using the latest versions.
Joined: Sep 21, 2011
Not sure what this new pool is supposed to do differently, but if you were using Tomcat's built-in DataSource, you would/could have been using connection pooling for years. And if you weren't using that, you could have used Apache DBCP in your web app, and achieved pretty much the same result.
Tomcat has supported plugin connection pooling for probably a decade now. As shipped, there's a copy of the Apache DBCP pooler pre-supplied, but anyone that wants to can use alternate poolers as well. For a while, there was in fact a serious competitor to DBCP, although most people use DBCP now.
Customer surveys are for companies who didn't pay proper attention to begin with.
The JDBC Connection Pool org.apache.tomcat.jdbc.pool is a replacement or an alternative to the commons-dbcp connection pool.
So why do we need a new connection pool?
Here are a few of the reasons:
commons-dbcp is single threaded, in order to be thread safe commons-dbcp locks the entire pool, even during query validation.
commons-dbcp is slow - as the number of logical CPUs grow, the performance suffers, the above point shows that there is not support for high concurrency Even with the enormous optimizations of the synchronized statement in Java 6, commons-dbcp still suffers in speed and concurrency.
commons-dbcp is complex, over 60 classes. tomcat-jdbc-pool, core is 8 classes, hence modifications for future requirement will require much less changes. This is all you need to run the connection pool itself, the rest is gravy.
commons-dbcp uses static interfaces. This means you can't compile it with JDK 1.6, or if you run on JDK 1.6/1.7 you will get NoSuchMethodException for all the methods not implemented, even if the driver supports it.
The commons-dbcp has become fairly stagnant. Sparse updates, releases, and new feature support.
It's not worth rewriting over 60 classes, when something as a connection pool can be accomplished with as a much simpler implementation.
Tomcat jdbc pool implements a fairness option not available in commons-dbcp and still performs faster than commons-dbcp
Tomcat jdbc pool implements the ability retrieve a connection asynchronously, without adding additional threads to the library itself
Tomcat jdbc pool is a Tomcat module, it depends on Tomcat JULI, a simplified logging framework used in Tomcat.
Retrieve the underlying connection using the javax.sql.PooledConnection interface.
Starvation proof. If a pool is empty, and threads are waiting for a connection, when a connection is returned, the pool will awake the correct thread waiting. Most pools will simply starve.