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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constrain the number of unused connections kept in the pool #23815

Closed
wants to merge 1 commit into from

Conversation

matthewd
Copy link
Member

Just as we don't fill the pool with connections at boot, we generally needn't maintain a full pool just because we once needed that many.

For maximum compatibility, this behaviour is disabled by default, by setting the minimum to match the configured maximum. But by choosing to configure a lower minimum, and setting a suitable reaping_frequency (e.g., 10 minutes), you can now get a dynamic pool that keeps just what it is likely to need in the near future.

@thedarkone I'm pretty sure this is terrible 馃槙

Just as we don't fill the pool with connections at boot, we generally
needn't maintain a full pool just because we once needed that many.

For maximum compatibility, this behaviour is disabled by default, by
setting the minimum to match the configured maximum. But by choosing to
configure a lower minimum, and setting a suitable reaping_frequency
(e.g., 10 minutes), you can now get a dynamic pool that keeps just what
it is likely to need in the near future.
@matthewd matthewd self-assigned this Feb 22, 2016
@@ -328,6 +332,8 @@ def initialize(spec)

# default max pool size to 5
@size = (spec.config[:pool] && spec.config[:pool].to_i) || 5
@minimum_size = (spec.config[:pool_minimum] && spec.config[:pool_minimum].to_i) || @size
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should check and raise if @minimum_size > @size.

@matthewd
Copy link
Member Author

Addressed by #31221

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

Successfully merging this pull request may close these issues.

None yet

2 participants