Benchmarks
UPDATE
New benchmark that includes Tomcat's new JDBC pool is available here.
How were the benchmark results obtained?
In order to obtain the fairest database performance metrics:
- The tests were run under Linux running in single user mode i.e. apart from the kernel daemons there were no other running processes.
- Used the latest, publicly available, stable versions of C3P0/BoneCP/DBCP/etc.
- Ran each test 3 times and took averages.
- Started off with a dummy connection request to allow for lazy-loading hits, JIT-compiler to kick in, etc.
- Gave the same parameters to each pool. Since there are no partitioning options in C3P0/DBCP, allocated
(connections / partitionCount) to each partition (i.e. kept the same number of connections).
A BoneCP partition count of 1 is thus the equivalent of running C3P0/DBCP.
- Called the getConnection/releaseConnection method calls directly (i.e. not obtaining it via spring/hibernate)
Where's the code?
The benchmark code is part of the source distribution. Please report back your results!
Single Thread
- 1,000,000 get connection / release connection requests
- No delay between getting/releasing connection.
- Pool size range: 20-50.
- Acquire increment: 5
- Helper threads: 1
- Partition count: 1
Multi-Thread
- 500 threads each attempting 100 get/release connection
- No delay between getting/releasing connection.
- Pool size range: 50-200.
- Acquire increment: 5
- Helper threads: 5
Multi-Thread 10ms delay
- 500 threads each attempting 100 get/release connection
- We introduce a 10ms delay (Thread.sleep()) between the acquire connection and the release connection to simulate work being done with the connection.
- Pool size range: 50-200.
- Acquire increment: 5
- Helper threads: 5
Multi-Thread 25ms delay
- 500 threads each attempting 100 get/release connection
- We introduce a 25ms delay (Thread.sleep()) between the acquire connection and the release connection to simulate work being done with the connection.
- Pool size range: 50-200.
- Acquire increment: 5
- Helper threads: 5
Multi-Thread 50ms delay
- 500 threads each attempting 100 get/release connection
- We introduce a 50ms delay (Thread.sleep()) between the acquire connection and the release connection to simulate work being done with the connection.
- Pool size range: 50-200.
- Acquire increment: 5
- Helper threads: 5
Multi-Thread 75ms delay
- 500 threads each attempting 100 get/release connection
- We introduce a 75ms delay (Thread.sleep()) between the acquire connection and the release connection to simulate work being done with the connection.
- Pool size range: 50-200.
- Acquire increment: 5
- Helper threads: 5
Prepared Statement (single threaded)
- Fetches a single connection then calls 1,000,000 connection.prepareStatement(...) followed by an immediate statement close.
- No delay between calls
- Max statements: 30
- Max statements per connection: 30
- Helper threads: 5
Prepared Statement (multi-threaded)
- 500 Threads each attempting 100 get/release connection with no delays. After obtaining a connection, make a call to connection.prepareStatement(...) followed by a close statement request.
- No delay between calls
- Pool size range: 50-200.
- Acquire increment: 5.
- Helper threads: 5
Prepared Statement (multi-threaded, 10ms delay)
- 500 Threads each attempting 100 get/release connection with no delays. After obtaining a connection, make a call to connection.prepareStatement(...) followed by a close statement request.
- 10ms delay between open connection/release connection to simulate work done by the application.
- Pool size range: 50-200.
- Acquire increment: 5.
- Helper threads: 5
Prepared Statement (multi-threaded, 25ms delay)
- 500 Threads each attempting 100 get/release connection with no delays. After obtaining a connection, make a call to connection.prepareStatement(...) followed by a close statement request.
- 25ms delay between open connection/release connection to simulate work done by the application.
- Pool size range: 50-200.
- Acquire increment: 5.
- Helper threads: 5
Prepared Statement (multi-threaded, 50ms delay)
- 500 Threads each attempting 100 get/release connection with no delays. After obtaining a connection, make a call to connection.prepareStatement(...) followed by a close statement request.
- 50ms delay between open connection/release connection to simulate work done by the application.
- Pool size range: 50-200.
- Acquire increment: 5.
- Helper threads: 5
Prepared Statement (multi-threaded, 75ms delay)
- 500 Threads each attempting 100 get/release connection with no delays. After obtaining a connection, make a call to connection.prepareStatement(...) followed by a close statement request.
- 75ms delay between open connection/release connection to simulate work done by the application.
- Pool size range: 50-200.
- Acquire increment: 5.
- Helper threads: 5
What's next?
Have a look at some configuration options or proceed to the download section. You may also wish to view some user comments at the forum.