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

Don't drop connections if DB hasn't changed #175

Merged
merged 3 commits into from
Sep 23, 2022
Merged

Don't drop connections if DB hasn't changed #175

merged 3 commits into from
Sep 23, 2022

Conversation

levkk
Copy link
Collaborator

@levkk levkk commented Sep 23, 2022

Current behavior

If the config for the pools changes in any way, we drop all existing server connections and re-create new ones. That's not very efficient at scale.

New behavior

If the config for a pool did not change, the server connections are preserved. New connections are created only if the database config changed in any way. This includes changes to any of the configured users. A better optimization would be to only re-create the connections for the changed user. This should be done as a follow up, since this change was pretty easy to make and the better fix is a slightly more involved.

@drdrsh
Copy link
Collaborator

drdrsh commented Sep 23, 2022

@levkk We might want to add connect_timeout to the hash. That value is hard coded into the pool and if we don't drop the pool and recreate it then it won't be picked up with RELOAD

@levkk
Copy link
Collaborator Author

levkk commented Sep 23, 2022

@drdrsh Good to go.

@levkk levkk merged commit 964a5e1 into main Sep 23, 2022
@levkk levkk deleted the levkk-pool-fix branch September 23, 2022 18:32
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.

None yet

2 participants