Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

DBCP performance problems

843859Feb 6 2007 — edited Feb 6 2007
Hi,
I am having a performance problem using DBCP.

We have a unit test that gets a connection from the pool, run a SQL query, and return it to the pool. It is done in a loop a few times.

The times of different operations for a single thread running this test:
1. Get pooled connection ~2000ms (a connection that already exits in the pool, not creating a new connection)
2. Run the query ~250ms
3. Return connection to the pool ~1200ms

Getting a connection from the pool and returning it is significantly slower than running a query.

When I run the test case multi threaded, the time to get the connection and return it grows almost linear to the number of threads.

I set:
testOnBorrow = false
testOnReturn = false

Makes no difference.

I was under the impression that getting a connection from a pool is basically a collection operation once all connections are initialized (which is the case here).

Any ideas?

A couple of things I am considering:
1. Download the source and put a breakpoint.
2. Change to MySql proprietary DataSource implementation that also supports pooling.

Any help appreciated!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 6 2007
Added on Feb 6 2007
3 comments
907 views