Bug 46038 - Tomcat JDBC Connection Pool contribution
Summary: Tomcat JDBC Connection Pool contribution
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 6.0.18
Hardware: All All
: P2 enhancement (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
URL: http://svn.hanik.com/svn/repos/filip/...
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-19 07:56 UTC by Filip Hanik
Modified: 2010-02-25 21:51 UTC (History)
2 users (show)



Attachments
compiled version, source and test cases (83.56 KB, application/octet-stream)
2008-10-19 07:57 UTC, Filip Hanik
Details
documentation (14.77 KB, text/plain)
2008-10-19 07:58 UTC, Filip Hanik
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Filip Hanik 2008-10-19 07:56:03 UTC
Attached is a contribution of an alternate connection pool to Tomcat.
It includes documentation as well.

I would suggest this connection pool would
a) replace the default connection pool in tomcat-trunk
b) ship as an alternate connection pool in tomcat-6.0.x

Reasons for contribution:
The reasons for this new implementation are documented in jdbc-pool.xml

Main reasons are:
a) JDK independent. you wont get a NoSuchMethodException running the pool with the new java.sql.* apis in JDK 1.7 even though the it is compiled with 1.5

b) support for highly concurrent environment (performance). On average it is between 2 to 10 times faster than commons-dbcp

c) simplicity - the core pool is 8 classes to maintain, compared to 60+ with other implementations

d) flexibility - can easily be extended, also has a pluggable interceptor framework that lets you plug in custom components to control pool behavior.

e) Maintainable - part of Tomcat core, so simple that anyone can maintain it. Easier to maintain 8 classes, than have to rewrite 60+ to get another pool to perform and provide same feature set.

Build from source
svn co --username yjp --password yjp123 http://svn.hanik.com/svn/repos/filip/dbcp
cd dbcp/build
ant


Performance numbers
fhanik@solaris-devx 08:38:36: /development/filip/dbcp/build$ JAVA5
fhanik@solaris-devx 08:38:36: /development/filip/dbcp/build$ ant run
Buildfile: build.xml

run:
     [java] JUnit version 4.3.1
     [java] .[testDBCPThreads10Connections10]Test complete:9057 ms. Iterations:1000000
     [java] .[testPoolThreads10Connections10]Test complete:2015 ms. Iterations:1000000
     [java] .[testDBCPThreads20Connections10]Test complete:15332 ms. Iterations:2000000
     [java] .[testPoolThreads20Connections10]Test complete:4463 ms. Iterations:2000000
     [java] .[testDBCPThreads10Connections10Validate]Test complete:19765 ms. Iterations:1000000
     [java] .[testPoolThreads10Connections10Validate]Test complete:2049 ms. Iterations:1000000
     [java] .[testDBCPThreads20Connections10Validate]Test complete:43135 ms. Iterations:2000000
     [java] .[testPoolThreads20Connections10Validate]Test complete:4639 ms. Iterations:2000000
     [java]
     [java] Time: 101.495
     [java]
     [java] OK (8 tests)
     [java]

BUILD SUCCESSFUL
Total time: 1 minute 41 seconds
fhanik@solaris-devx 08:40:22: /development/filip/dbcp/build$ JAVA6
fhanik@solaris-devx 08:40:28: /development/filip/dbcp/build$ ant run
Buildfile: build.xml

run:
     [java] JUnit version 4.3.1
     [java] .[testDBCPThreads10Connections10]Test complete:2400 ms. Iterations:1000000
     [java] .[testPoolThreads10Connections10]Test complete:1919 ms. Iterations:1000000
     [java] .[testDBCPThreads20Connections10]Test complete:5570 ms. Iterations:2000000
     [java] .[testPoolThreads20Connections10]Test complete:4109 ms. Iterations:2000000
     [java] .[testDBCPThreads10Connections10Validate]Test complete:15986 ms. Iterations:1000000
     [java] .[testPoolThreads10Connections10Validate]Test complete:2025 ms. Iterations:1000000
     [java] .[testDBCPThreads20Connections10Validate]Test complete:38999 ms. Iterations:2000000
     [java] .[testPoolThreads20Connections10Validate]Test complete:4336 ms. Iterations:2000000
     [java]
     [java] Time: 76.391
     [java]
     [java] OK (8 tests)
     [java]

BUILD SUCCESSFUL
Total time: 1 minute 16 seconds
fhanik@solaris-devx 08:41:46: /development/filip/dbcp/build$
Comment 1 Filip Hanik 2008-10-19 07:57:23 UTC
Created attachment 22756 [details]
compiled version, source and test cases
Comment 2 Filip Hanik 2008-10-19 07:58:16 UTC
Created attachment 22757 [details]
documentation
Comment 3 Filip Hanik 2008-10-19 08:00:40 UTC
To migrate from commons-dbcp/tomcat-dbcp to this new pool requires a single attribute change - factory - in the resource element.

All the other attributes are identical. Making it easy to switch to and back.
Comment 4 Filip Hanik 2008-11-12 17:32:21 UTC
Completed and contributed as a module
Comment 5 Phil Steitz 2009-09-06 17:42:13 UTC
What versions of commons dbcp and pool were used in the microbenchmarks?  Comments in the doc indicating that dbcp locks the pool on validate, etc., would indicate you must be referring to pool 1.3.  As of pool 1.4, this is not true.  Is the source for the benchmarks available anywhere?
Comment 6 Filip Hanik 2010-02-25 21:51:49 UTC
(In reply to comment #5)
> What versions of commons dbcp and pool were used in the microbenchmarks? 
> Comments in the doc indicating that dbcp locks the pool on validate, etc.,
> would indicate you must be referring to pool 1.3.  As of pool 1.4, this is not
> true.  Is the source for the benchmarks available anywhere?

DBCP 1.4 while solving the validation bottleneck, introduces a new set of performance reducing code, and handles worse than 1.3.

  svn co http://svn.apache.org/repos/asf/tomcat/trunk/modules/jdbc-pool
  cd jdbc-pool
  ant test