thanks,
Krishna
I have a couple of thoughts.
HikariCP has a "rollback-on-return" policy, which cannot be disabled because it ensures correctness. By which I mean, imagine that a thread runs some SQL on a connection, but subsequently neither commits nor rolls back, and then returns the connection to the pool. If the pool simply gives that connection to another thread, "bad things" can happen. Therefore HikariCP performs a rollback when the connection is returned. Which could be bad performance-wise, but HikariCP is smart about it -- it tracks the transaction state and skips the rollback if no SQL has been run since the last commit or rollback by the application.
Looking at the table you attached, I see the average calls/txn for getConnection() is 7.04. However, the average calls/txn for JDBCTransaction.commit() is only 4.04. This leads me to believe that maybe your application, or Hibernate itself is eliding a commit() in some cases -- maybe in the case of read only transactions? If this is so, HikariCP will be led to believe that it needs to rollback -- which is a big hit even when there is nothing to actually rollback.
A simple getConnection()/close() cycle (no SQL) runs at >25000 ops/ms in HikariCP against MySQL. But as soon as you introduce a rollback against MySQL --getConnection()/rollback()/close() -- the throughput drops to ~20 ops/ms. Yes, that's from 25000 to 20 (like the number of fingers and toes you have).
Arguing against this theory is that I would expect Connection.close() to show up as an equal heavy-hitter in that table.
The second thought I have is "metrics". I can see you're already using New Relic, so you know the value of metrics. If you can (or already have) enabled Dropwizard metrics, the pool stats collected might provide some insights. Failing that, even the basic stats collected by the default JMX MBean and charted, would be helpful.
You'll need v2.3.9, because v2.3.8 had a regression preventing the MBeans from registering properly.
Lastly, there is not much in the getConnection() code path to delay obtaining a connection except, 1) a shortage of connections, or 2) the cost of the connection validation. As an experiment, can you set the system property com.zaxxer.hikari.aliveBypassWindow to 5000 (milliseconds)? This would need to be set before the pool is constructed.
Thanks.