• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Tomcat JDBC Connection Pool

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Saloon Keeper
Posts: 7585
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Saloon Keeper
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you provide us with a link about this?

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.
 
K Mansoor
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tomcat 7.26 (JDBC Pool)


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.

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic