Skip to content
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

Allow for a configurable variance on maxLifetime timeouts #2004

Open
ssherwood opened this issue Nov 14, 2022 · 2 comments
Open

Allow for a configurable variance on maxLifetime timeouts #2004

ssherwood opened this issue Nov 14, 2022 · 2 comments

Comments

@ssherwood
Copy link

Currently, HikariCP adds a 2.5% variance on the maxLifetime to reduce the impact of max eviction of the connection pool:

// variance up to 2.5% of the maxlifetime
final var variance = maxLifetime > 10_000 ? ThreadLocalRandom.current().nextLong( maxLifetime / 40 ) : 0;

It would be advantageous to have this be configurable and not specifically proportional to the maxLifetime duration itself.

@Avarga954
Copy link

Avarga954 commented Feb 1, 2023

I would absolutely love this functionality I just came here to create this issue myself. Ideally a configurable percentage.

Utilizing both RDS/Aurora DB in conjunction with HikariDB I am regularly getting issues with the mass extinction of connections and reopening which generally causes issues with load balancing on the DB side by overloading replicas.

Aurora DB reader endpoints utilize a round robin DNS based load balancing with a TTL which can end up getting any new connection request routed within a small time frame to the same replica.

Utilizing RDS Proxy is supposed to mitigate this exact issue but I am still seeing similar problems due to the mass extinction of connections even when routing through RDS proxy.

This issue can be exacerbated when deploying your applications on Kubernetes when multiple pods can stand up simultaneously within a small window of time.

Allowing a configurable jitter/variance would dramatically improve the stability of our applications by allowing us to tune them explicitly. The only knob we have to currently adjust is the "MaxLifeTime" setting which will increase the default variance but that is not ideal since if new DB replicas are added to the connection pool it can delay their utilization by HikariCP.

Other tickets that I have been following.
#1247
#480

@brettwooldridge I would love to hear your thoughts on this, I have taken this issue up with AWS technical support but I think the only way of resolving this issue is going to be at the HikariCP level.

@Avarga954
Copy link

Just to follow up here,

I went ahead and took the initiative to spin up a PR with this desired change.

#2035

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants