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

RUST-1712 Provide a connection pool warmup method #932

Merged
merged 5 commits into from
Aug 17, 2023

Conversation

abr-egn
Copy link
Contributor

@abr-egn abr-egn commented Aug 14, 2023

RUST-1712

This works by spawning a task that sends check out requests in a loop until the receiving worker reports that the pool has hit min_pool_size. This is a little indirect but seems to have the fewest drawbacks compared to other methods I considered:

  • because they're mostly-normal checkout requests, any constraints or other handling of those continues to apply
  • allows the worker to continue to process other requests while the pool is warming; initially I was going to implement this loop directly in the worker but that would block requests during the warmup.

///
/// Note that topology changes require rebuilding the connection pool, so this method cannot
/// guarantee that the pool will always be filled for the lifetime of the `Client`.
pub async fn warm_connection_pool(&self) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm open to naming suggestions here. "warm" seems a little vague but I couldn't think of a better one that wasn't super verbose.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah this seems fine to me. can you note in the comment for this method that nothing will happen if min_pool_size is 0?

@abr-egn abr-egn marked this pull request as ready for review August 15, 2023 14:13
@abr-egn abr-egn requested a review from isabelatkinson August 15, 2023 14:13
Copy link
Contributor

@isabelatkinson isabelatkinson left a comment

Choose a reason for hiding this comment

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

one small comment, no need for re-review!

///
/// Note that topology changes require rebuilding the connection pool, so this method cannot
/// guarantee that the pool will always be filled for the lifetime of the `Client`.
pub async fn warm_connection_pool(&self) {
Copy link
Contributor

Choose a reason for hiding this comment

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

yeah this seems fine to me. can you note in the comment for this method that nothing will happen if min_pool_size is 0?

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