DBCP performance problems
843859Feb 6 2007 — edited Feb 6 2007Hi,
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!