Repository navigation
perf(db): keep the connection pool warm and bounded - #16
Merged
Merged
Conversation
The default pool keeps only two idle connections and opens unbounded new ones, so bursty hot paths on remote mesh nodes repeatedly pay the peer tunnel setup cost (tcp, ssh handshake, tls, postgres auth — several cross-region roundtrips folded into whichever statement triggered the dial). Keep eight warm for five minutes and cap each node at sixteen so its footprint on the shared postgres stays predictable. Claude-Session: https://claude.ai/code/session_01CgmQm9dfiuFwheFGfQA8Zz
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #16 +/- ##
==========================================
- Coverage 62.49% 62.28% -0.21%
==========================================
Files 28 28
Lines 2293 2299 +6
==========================================
- Hits 1433 1432 -1
- Misses 688 692 +4
- Partials 172 175 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
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.
Summary
Remote mesh nodes showed SQL p50 ~5x the raw RTT: the default pool (2 idle,
unbounded open) makes bursty paths repeatedly pay the peer tunnel setup cost
(tcp + ssh + tls + postgres auth ≈ 1.5-2.5s), folded into whichever statement
triggered the dial.
max_connections=200)
Changed
connections, avoiding repeated peer tunnel setup costs on remote nodes
Test plan
make test(postgres +-race),make lint,make lint-mulintall cleanremote SQL p50 to drop from ~850-980ms toward the ~1x RTT floor)