forked from rails/rails
-
Notifications
You must be signed in to change notification settings - Fork 1
Documentation for new Database Pooling configs #3
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
Open
ChaelCodes
wants to merge
17
commits into
matthewd:impeller
Choose a base branch
from
ChaelCodes:volute
base: impeller
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51a24da
to
92f0a45
Compare
We should still avoid using them whenever possible, but e.g. I'd like to be able to break connections inside a pool test.
The shared setup method creates a connection pool, and having the isolation level change after a pool is created makes things awkward. This has slightly more duplication, but not enough that I feel the need to seek a different abstraction.
In the process, be more consistent about always disconnecting pools we've created.
Building upon the "checkout for maintenance" primitives, this gives us a method to progressively loop over idle connections without the risk of starving the pool while we work. Even for something internal, I don't love the API... but hopefully it will suffice until we come up with something better.
Co-authored-by: Chris AtLee <[email protected]>
Co-authored-by: Chris AtLee <[email protected]>
Optionally ensure the full database connection chain sees regular query traffic (without affecting our internal idle counters).
Avoid using database connections that were originally established over the configured duration ago. This can be helpful to provide smooth failover between connection proxies.
This is ideal where the caller knows that a database server/proxy failover is occurring (meaning that previously-established connections are now potentially pointing to the wrong place, and new fresh connections will go to the right one); where such signalling is possible, it can be used in place of an onerously low / "preventative" max_age.
It's less elegant, but just seems easier to reason about.
…ctions Co-authored-by: Matthew Draper <[email protected]>
Co-authored-by: Matthew Draper <[email protected]>
Co-authored-by: Matthew Draper <[email protected]>
ChaelCodes
commented
Jan 21, 2025
Comment on lines
+3597
to
+3604
<!-- Suggestions please --> | ||
Idle database connections can be bad - the database may no longer exist, or | ||
may assume the application server no longer exists. `keepalive` will check | ||
open database connections and keep them alive. | ||
|
||
<!-- How does this interact with idle_timeoue? --> | ||
<!-- How does this interact with min_connections? --> | ||
<!-- How does this interact with INFINITY? --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @matthewd
Hi, could you kindly offer some suggestions or thoughts on how these configurations interact with each other?
Maybe some of these details could/should be moved to https://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/ConnectionPool.html ?
c184e9a
to
b0ec072
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation / Background
This Pull Request updates the guides to reflect the changes introduced in rails#54175.
Checklist
Before submitting the PR make sure the following are checked:
[Fix #issue-number]