-
-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HikariCP module #2993
Comments
Nice !! Are you looking to contribute it to be part of ebean or ebean-datasource?
By this we mean that it supports using the "spring.datasource" style prefix or something else? Note that we can just supply a javax.sql.DataSource via
Were those the motivation for doing this or was there something else that this helps with?
The bundled connection pool has its own "magic sauce" which sets it apart from all the datasource pools I know including HikariCP which is its strategy for testing connections (when to run connection validation). The ebean datasource has a strategy of "testing on exception" + "testing in the background". "Testing on exception" means that any connection that is returned to the pool that threw a SQLException is validated. This works well because:
HikariCP tests based on elapsed time + in the background. Other pools use "test on borrow" or "test on return" but then that adds overhead every single time a connection is obtained. HikariCP internally takes the path of ThreadLocal based caching. Ebean DataSource pool takes the path of internal data structures optimised for holding "busy" and "idle" connections with pre-sized arrays based on maxConnections etc (I'm unconvinced that ThreadLocal is a good long term strategy here with respect to Loom / Virtual Threads). Ebean DataSource pool includes PreparedStatement caching and HikariCP leaves that to the driver. Ebean DataSource pool defaults to "automatic size tuning" meaning that we just allow the pool to grow (up to max) and shrink based on maxIdleTime and this works very well in practice wrt pool sizing. There are differences of opinion and implementation as you would expect. Today, for anyone who asks me, I still very much recommend using the Ebean DataSource pool. I believe it is the most robust pool. It is also very fast although it may not be quite as fast as HikariCP with its ThreadLocal based caching. Cheers, Rob. Edit: Made some edits to this adding some extra details. |
Thank you so much for such a thoughtful response!
If you want, you can use any part of HiBean project as you want: all permissions are granted. The main reason to publish the link here, to give a solution if somebody asks "How to use Ebean with HikariCP" (without Spring etc.)
This too, but not as a main meaning. The module is used internally in tests without Spring context and all developers are used to Hikari. BTW I think your pool is in the shadow of Ebean. For example: developers from Red Hat have developed their own connection pool, used primarily (as I know) in Quarkus. After such a detailed comparison of the internal structure of your pool and HikariCP, I have a question: |
Thank you very much for a great product!
I can't believe that it is not mainstream instead of Hibernate!
I have made for my needs a HikariCP integration for Ebean.
It is an easy-to-use seamless drop-in replacement for the bundled connection pool.
https://github.com/magicprinc/hibean
It has even mappings file for ebean-to-hikari property mappings:
https://github.com/magicprinc/hibean/blob/main/src/main/resources/ebean/ehpalias.properties
so it is quite possibly to run it (after some additions to this file) without modifications of config file
(i.e. with the same application.properties).
It also supports Spring Boot property-naming-convention.
I hope you enjoy it :-)
The text was updated successfully, but these errors were encountered: