Weeks 05/28/2017 - 06/11/2017 Assessing HikariCP and MariaDB driver

Trying to back fill a few weeks of tech reports before I forgot what I did:

Spend 2 weeks assessing 2 libraries: 
 - HikariCP: https://github.com/brettwooldridge/HikariCP
 - MariaDB Connector/J: https://github.com/brettwooldridge/HikariCP

Context:
Moving our database from mysql to AWS aurora and MariaDB is the recommended driver library. HikariCP is the most popular jdbc connection pool library and I'm thinking about upgrading from BoneCP to HikariCP.

HikariCP:
Upgrade was fairly simple and configuration can be easily translated to the matching configuration in BoneCP. 
The major blocker for me is performance: tested HikariCP integration production environment and compared result to BoneCP, queries using HikariCP is consistently slower than queries using BoneCP. A frequently used simple select (for auth) takes on avg 1ms with BoneCP, but 2ms on HikariCP, another frequently used update query takes 2ms with BoneCP but 3mc with HikariCP.
More details:
http://xingdu.blogspot.com/2017/05/performance-between-bonecp-and-hikaricp.html
https://github.com/brettwooldridge/HikariCP/issues/900

MariaDB driver:
Assessed 2.0.1 version and ran into compatibility issue with Aurora. Spent a day debugging and found out it was due to a flag introduced in 1.6.0 / 2.0.0 (usePipelineAuth defaults to true and apparently doesn't work with Aurora yet)
Filed a ticket with developer:
https://jira.mariadb.org/projects/CONJ/issues/CONJ-477
And ran into another exception during failover testing:
https://jira.mariadb.org/projects/CONJ/issues/CONJ-484
1st one is easily resolved by downgrading to 1.5.9 version, but 2nd one has not been fixed yet, which blocked me from moving forward.

With the help of tcpdump, I can basically tell how mariadb driver works for Aurora failover: it queries a table in aurora which records the instance end-points behind a cluster end-point as well as the role, and the driver tries to be smart about which one to connect to during failover.
I'm personally not a big fan of this idea. To me the client (in this case driver) should be as dump as possible. If connection is disposed per query, and every time we create a new connection with the cluster endpoint, we'd be fine since the cluster endpoint will always point to the valid instance, even during failover(excluding DNS cache). So my call on that is not to use MariaDB driver and continue with the stable mysql driver we had before.

By setting connection age to be 1 min, the possible window for data loss is up to 1 min. And on top of that I do have a my own ip change detector running per 15s, meaning during failover it will catch up the change in less than 15s. This is already better than what MariaDB can offer and I'm happy with staying with the same stable libraries.

Comments

Popular posts from this blog

Week 07/02/2017 - 07 /09/2017 Rewrite Memcached Cluster Accessor

Week 10/22/2017 - 10/29/2017 Repository migration & Deployment process improvement

Week 07/09/2017 - 07/16/2017 Profiling & Performance Improvement