Tuesday, May 30, 2017
Performance between BoneCP and HikariCP
I've been assessing HikariCP as a replacement for BoneCP for my server in the past week, and the result is somewhat surprising to me.
Sharing it here in case other people were doing the same thing.
The short conclusion is: BoneCP is slightly faster than HikariCP.
Test environment:
- BoneCP version: 0.8.0-RELEASE
- HikariCP version: 2.6.1
- Tested on 2 groups of servers located on Amazon AWS, with DB servers in the same availability zone.
- The only difference in the version of jar deployed is the connection pooling library difference (as well as the configuration difference)
The variation in configuration does not seem to make a big difference.
Tested by using the recommended configuration from each library, and for
1st test: trying to map the configuration by meaning
2nd test: match number of connections per host
Both tests give me the same result: the measured wall time for HikariCP is constantly 1~2ms slower than using BoneCP.
This is tested on a live product which has >100K concurrent users all the time and the range of tested queries has covered a few benchmark tests.
For faster database queries, this can be pretty significant: running an indexed select queries from a table costs 1ms on avg for BoneCP group but 2ms for HikariCP
Similarly this affects other queries including inserts & updates & deletes. Due to the range of the queries I have, the difference is 1~2ms.
After reading through this:
https://github.com/brettwooldridge/HikariCP/wiki/Pool-Analysis
I started to wonder if it's the validation overhead that's causing the performance difference.
And the awesome developer for HikariCP told me there are ways to configure that:
https://github.com/brettwooldridge/HikariCP/issues/900
So I did a 3rd & 4th test by:
- increase the window of validation check from 500ms to 5s
- override the test connection query from using jdbc isValid method to a simple "SELECT 1"
Unfortunately the result is the same, and the difference is roughly the same too.
So the connection test is not the culprit for performance different, at least on my environment.
Although I think the validation check is good and should be there, I've stopped at this point because I know BoneCP would probably be my go-to option given the performance result.
For now I'm unable to explain the performance different, and that's what needs to be updated. I'll dig the source code a bit further when I have some more time to spend on this.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment