Repository navigation
Give the critical Postgres pool room for slow WAL flushes - #312
Merged
Merged
Conversation
Inbox transitions, outbox receipts and update materialization share the critical pool, and each holds its slot until the WAL flush returns. When storage latency rose tenfold, eight slots starved inbox claims and outbox receipts (3 s acquire timeouts), the durable consumer drained slower than updates arrived, and messages aged past the 5 min stale cutoff. Raise the critical pool to 16 slots. The durable consumer cap follows at three workers per slot, so the 8-CPU host runs 32 inbox workers instead of 24. The general pool keeps its 42 slots; 58 in total stays well under max_connections = 100.
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.
Problem
Inbox transitions (claim, state checkpoint, complete), outbox receipts, and update materialization share the critical Postgres pool. Each of these operations keeps its connection until the WAL flush of its commit returns.
During a production incident on 2026-12-01, storage write latency rose about tenfold while the I/O volume stayed the same:
pool timed out).Change
POSTGRES_CRITICAL_MAX_CONNECTIONS: 8 → 16.max_connections = 100.Verification
cargo fmt --all -- --checkcargo test -p openplotva-storage postgres_capacitycargo test -p openplotva-app durable_update_consumercargo clippy --workspace --all-targets -- -D warnings