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

Add maxUses config option to Pool #2157

Merged
merged 1 commit into from
Apr 9, 2020
Merged

Conversation

chriskchew
Copy link
Contributor

NOTE: This PR is a second take on #2147, based on feedback from @brianc

This PR adds an optional pool configuration maxUses and adds logic to the Pool that removes a connection upon release when it has been acquired and released maxUses number of times.

The intention is to help with balancing connections to a growing read replica cluster. Specifically, this scenario came up when adopting AWS Aurora in an environment where the read replica cluster expands and contracts based on weekly traffic cycles. When the pool is full of healthy connections to the pre-scale-up instances, the new instances never see any traffic unless you bounce all the app instances. By artificially "expending" a client after a number of uses, we can attain a better balance across all the replicas.

Also added some instructions in the main README listing the steps for dev setup

Thank you for considering these changes and your guidance along the way!

Copy link
Owner

@brianc brianc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work! Thank you so much! This diff is much easier to review which is cool. Also, I love that you added documentation for this feature. I'll ship a new semver minor within the hour w/ this change & follow up on the PR!

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

Successfully merging this pull request may close these issues.

2 participants