-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
refactor: Added min idle and max lifetime for database config #2900
Merged
Conversation
This file contains 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
github-actions
bot
added
the
S-conventions-not-followed
Status: This PR does not follow contributing guidelines
label
Nov 17, 2023
akshay-97
changed the title
added min_idle, max_lifetime for database config
refactor: added min_idle, max_lifetime for database config
Nov 17, 2023
github-actions
bot
removed
the
S-conventions-not-followed
Status: This PR does not follow contributing guidelines
label
Nov 17, 2023
jarnura
previously approved these changes
Nov 17, 2023
dracarys18
reviewed
Nov 17, 2023
Comment on lines
95
to
97
database | ||
.max_lifetime | ||
.map(|x| std::time::Duration::from_secs(x)), |
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.
Suggested change
database | |
.max_lifetime | |
.map(|x| std::time::Duration::from_secs(x)), | |
database | |
.max_lifetime | |
.map(std::time::Duration::from_secs), |
dracarys18
previously approved these changes
Nov 17, 2023
github-actions
bot
added
the
S-conventions-not-followed
Status: This PR does not follow contributing guidelines
label
Nov 22, 2023
akshay-97
changed the title
refactor: added min_idle, max_lifetime for database config
refactor: added min idle, max lifetime for database config
Nov 22, 2023
github-actions
bot
added
S-conventions-not-followed
Status: This PR does not follow contributing guidelines
and removed
S-conventions-not-followed
Status: This PR does not follow contributing guidelines
labels
Nov 22, 2023
akshay-97
changed the title
refactor: added min idle, max lifetime for database config
refactor: Added min idle and max lifetime for database config
Nov 22, 2023
github-actions
bot
added
S-conventions-not-followed
Status: This PR does not follow contributing guidelines
and removed
S-conventions-not-followed
Status: This PR does not follow contributing guidelines
labels
Nov 22, 2023
github-actions
bot
removed
the
S-conventions-not-followed
Status: This PR does not follow contributing guidelines
label
Nov 23, 2023
dracarys18
approved these changes
Nov 28, 2023
jarnura
approved these changes
Nov 28, 2023
lsampras
added a commit
that referenced
this pull request
Nov 28, 2023
Co-authored-by: akshay.s <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Gnanasundari24 <[email protected]> Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
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.
Type of Change
Description
Added min_idle : minimum number of connections to be maintained as idle in pool all times (default 0), and max_lifetime:
maximum lifetime of connections after which they will be removed from the pool ; options in database Config, allowing
custom values to be set while running application.
Additional Changes
Motivation and Context
having no idle connections in pool requires application to create new db connection for each request(sparse requests that come after idle_timeout, so no connections are available in pool when min_idle = 0), maintaining minimum connections should have marginal improvement in latency in such cases
How did you test it?
Config set:
min_idle : 2
idle_timeout : 120 secs
Test Sequence:
t0 : /payments
t130 : /payments
check the active/idle connections in psql using:
select * from pg_stat_activity where "datname" = 'hyperswitch_db';
or tcp connections made from app to database:
lsof -i tcp:5432 | grep router
Checklist
cargo +nightly fmt --all
cargo clippy