Default to LIFO connection reuse (server_round_robin: false) so idle reaping works under sustained load - #22
Closed
micahjz wants to merge 3 commits into
Closed
Default to LIFO connection reuse (server_round_robin: false) so idle reaping works under sustained load#22micahjz wants to merge 3 commits into
micahjz wants to merge 3 commits into
Conversation
…orks under sustained load
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
Flip the base pgcat chart to LIFO connection reuse by setting
server_round_robin: false, so idle-connection reaping actually fires under sustained load.Root cause
pgcat's code default for
server_round_robinistrue(src/config.rs:437, pinned by the test atsrc/config.rs:1866; the// Falseinline comment at line 324 is stale).truemaps toQueueStrategy::Fifo(src/pool.rs:493).In bb8 0.8.6,
get()alwayspop_front()and under FIFOput()doespush_back(). That makes the idle deque a true rotating queue: every checkout takes the front connection and returns it to the back.idle_startis reset only on checkin (put()), so under sustained traffic FIFO rotation touches every connection continuously and no connection ever reachesidle_timeout(30s). The reaper runs every 30s, finds nothing older than the threshold, and evicts zero. Result:connections_closed_idle_timeout = 0whileconnections_created > 0, and the pool stays pinned atpool_size.Evidence (env:prod*)
Low-traffic pools (finance_data, ~5 txn/s) reap normally because long quiet gaps let connections drift past 30s. High-traffic pools never get that gap. The running
-ropod confirms the effective value:pgcat::config: Server round robin: true.Faithful bb8 simulation (agi_readonly-like pod)
Changes
charts/pgcat/values.yaml— addserver_round_robin: false(with explanatory comment).charts/pgcat/templates/secret.yaml— render the key intopgcat.toml's[general]block. The template previously omittedserver_round_robinentirely, which is exactly why prod silently ran the FIFO default. Without this line the values change is inert.charts/pgcat/Chart.yaml— bump0.2.5 → 0.2.6.Non-goals / constraints respected
server_lifetime(intentionally long to avoid synchronized mass expiry).min_pool_size.Rollout note
This changes the base-chart default for all deployments consuming this chart. LIFO concentrates load on a small hot working set and lets the cold tail age out — desirable here. After rollout, confirm
pgcat.pgcat_databases_connections_closed_idle_timeout.countstarts firing for agi/agi_readonly andsv_idledrains towardmin_pool_size.