Project Java Article

Tomcat Connection Pool Optimization

Indexing special terms can tricky in Solr. Is that period the end of a sentence, or the start of a technology name? Continue reading to see how to tell the difference and provide stellar, fast solr search results to your customers.

Tomcat JDBC Connection Pool Tuning

In Tomcat 7, the default connection pool provider is DBCP.  The Tomcat authors obviously realized that this pooling implementation wasn't ready for prime time, so they created their own implementation.  The team at Apache has done a very thorough job of outlining all the shortcomings of DBCP along with the features of their new implementation.

As of this writing, both Tomcat 7 and Tomcat 8 use the DBCP Connection Pool by default when you declare a Datasource as a <Resource/> in your context.xml.  Perhaps one day the production ready implementation will be the default.  Until then, frustrated DevOps Engineers will find this article useful and necessary.

Using the Tomcat Connection Pool

Follow the instructions in the resource link to take full advantage of the high performance Tomcat Connection Pool.  Depending on your database, certain parameters will have more positive tuning effects than others.  The key to removing the DBCP Pool and using the Tomcat Connection Pool is the factory parameter.

Here is a starter example for an Oracle database.

<Resource
    name="jdbc/myDataSource"
    auth="Container"
    type="javax.sql.DataSource"
    factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
    driverClassName="oracle.jdbc.driver.OracleDriver"
    url="jdbc:oracle:thin:@oracle.domain.com:1521:SID"
    username="scott"
    password="tiger" />

Ready To Get Started

Whether you need help configuring your Java App container connection pool, or require the delivery of a fully functional Solr core, the staff at Prowave Consulting can assist with 1% or 100% of your development needs. Our flexible service offering can work within your framework, from acting as a consulting arm to your development team to providing a statement of work to develop and implement an entire production environment for your organization. For help or to schedule a consultation, we can be reached at 904-302-7734 or by using our Contact Form.


Request For Services

Please fill out the form below and we will get back to you soon.