Repository navigation
docs: ADR 0012, pool pre-ping is off and postgres_retry recovers dead connections - #56
Merged
Merged
Conversation
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.
ADR 0012 records why
pool_pre_pingis off (#54). The record also states the rule that pays for the decision: every query a retried use case runs must be inside itsTransactionblock.Measurements behind the ADR
chat-app main at 31eee00 (db-retry 0.8.0). The app (granian, 1 worker), Postgres 17 and an httpx load generator ran as containers on one Docker network on Docker Desktop. Only
DB_POOL_PRE_PINGdiffered between runs. Each run had a 5 s warm-up and a 10 s window, the API was recreated at each switch, and on and off alternated. No run had errors.Postgres's statement log for 500
GET /api/auth/me/requests shows each request making two pool checkouts, one for the token-revocation check and one for the use case. With pre-ping on there were 2002 BEGINs and 1001 ROLLBACKs, against 1002 and 1 with it off. The;ping itself isn't logged.Local network, 3 rounds (req/s per round, median p50 and p99):
GET /api/auth/me/GET /api/auth/me/GET /api/chats/{id}/messages/GET /api/chats/{id}/messages/tc qdisc add dev eth0 root netem delay 1mson the db container, 2 rounds:GET /api/auth/me/GET /api/auth/me/GET /api/chats/{id}/messages/GET /api/chats/{id}/messages/