-
Notifications
You must be signed in to change notification settings - Fork 922
[db] connection pool optimization - 2x speedup in remote postgres environment #6998
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
Conversation
495a79b to
f9effe7
Compare
|
/smoke-test --aws --postgres https://buildkite.com/skypilot-1/smoke-tests/builds/3016 (PASS) |
|
/smoke-test -k test_managed_jobs_recovery_aws (PASS) |
|
/smoke-test --aws --remote-server |
rohansonecha
left a comment
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.
This is awesome! Thank you @SeungjinYang
aylei
left a comment
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.
LGTM, thanks @SeungjinYang !
If postgres DB supports enough connections for every process (executor, uvicorn worker, main loop), use a persistent connection instead of NullPool (which does connection setup/teardown for every DB op) to save on connection setup/teardown time.
We have been using NullPools to save on total # of connections at any given time because we didn't have visibility on the number of connections a PSQL instance supports. Now that we are able to get this number, we're able to make smart choices in the trade-offs to make.
Testing:
Running
sky statuson a remote API server on GKE with GCP cloud SQL backend, using IAM auth.Initial few runs of
sky statusare discarded to fully load modules and initialize the db connections.this PR
2.921
2.810
2.874
2.970
2.850
avg: 2.885
master
5.515
5.492
6.008
5.590
6.111
avg: 5.7432
This PR is approx. 2X faster.
Tested (run the relevant ones):
bash format.sh/smoke-test(CI) orpytest tests/test_smoke.py(local)/smoke-test -k test_name(CI) orpytest tests/test_smoke.py::test_name(local)/quicktest-core(CI) orpytest tests/smoke_tests/test_backward_compat.py(local)