Skip to content

Door pools keep an idle connection 120 s, not 240 s - #635

Merged
jthingelstad merged 1 commit into
mainfrom
session/edge-and-connections-idle-120
Oct 21, 2026
Merged

jthingelstad merged 1 commit into
mainfrom
session/edge-and-connections-idle-120

Conversation

@jthingelstad

@jthingelstad jthingelstad commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

Follow-up to #622, for #630.

#622 raised the door pools' idle timeout from 30 s to 240 s. At 01:33 CDT the same morning RDS reported the db.t4g.micro "critically low on memory" and lowered shared_buffers from 23,081 to 11,295 pages for the next restart (#630). DatabaseConnections went from 1 to 3 to about 5.

This weighs what 240 s bought against what it held, and settles on 120 s.

Method. A week of real requests, replayed per environment through pg-pool's own rules (LIFO reuse, the idle timer, min, the 300 s lifetime and each door's max). The requests were 2,833 web-api reads that took a lease, 2,539 MCP tool calls and the collector's leases. The replay matches what was observed:

  • At 30 s it gives web-api 61.6% fresh connections, against 61.8% observed.
  • After the deploy it gives 3.73 backends, against 3.86 in Enhanced Monitoring.

Benefit and cost:

idle week fresh (web-api + MCP) share of 240 s's saving extra backends, week avg quiet half-day avg under acceptance load
30 s 2,665 of 5,372 0% 0 1.21 2.65
60 s 2,375 51% +0.12 1.32 2.93
120 s 2,195 82% +0.34 1.54 3.31
240 s 2,091 100% +0.72 1.93 3.82
  • What it buys. Web-api's fresh share falls from 62% to about 45%, and connect_ms p50 falls from 33 ms to 0. MCP barely moves. The collector was already warm.
  • What it costs. About 6 to 7 MB per idle backend (free plus cached fell 16 MB for 2.4 more backends).
  • Swap. It follows acceptance's heavy reads more than the timeout.
  • Ruled out. min: 1 with a short idle holds nearly as much as 240 s, because the kept connection lives its full 300 s.
  • Pool max stays. Bursts are what need it.

[engineering] default changed: DECISIONS' door-pool line now says 120 s, with the evidence in docs/notes/2026-10-21-pool-idle-120.md. No contract moves.

npm run verify green. e2e-needed.sh prints false.

🤖 Generated with Claude Code

RDS reported the micro critically low on memory after #622 and lowered
shared_buffers for the next restart (#630). Replayed a week of requests
through the pool: 120 s keeps 82% of 240 s's saved connections (89% on a
quiet half-day) for about half the idle backends. web-api's connect_ms
p50 stays at 0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@jthingelstad
jthingelstad marked this pull request as ready for review October 21, 2026 07:02
@jthingelstad
jthingelstad enabled auto-merge (rebase) October 21, 2026 07:02
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-21T08:35:14.626619Z 5e78ac0 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@jthingelstad
jthingelstad merged commit 5e78ac0 into main Oct 21, 2026
7 checks passed
@jthingelstad
jthingelstad deleted the session/edge-and-connections-idle-120 branch October 21, 2026 07:03
@jthingelstad

Copy link
Copy Markdown
Owner Author

Deployed to production 2026-10-21T07:11:58Z (2026-10-21 02:11:58 CDT).

  • Commit: 5e78ac0e (platform lane); this PR's: 5e78ac0e
  • MCP contract: 11.13.3
  • JSON API: 3.2.1
  • Acceptance: passed (--acceptance=game)

@jthingelstad

Copy link
Copy Markdown
Owner Author

@codex review

@jthingelstad

Copy link
Copy Markdown
Owner Author

Read back live (02:12 to 04:07 CDT): app backends averaged 2.20 (Enhanced Monitoring) against 3.57 at 240 s and 1.36 at 30 s the same hours yesterday. DatabaseConnections averaged 2.3 against 3.5. web-api connect_ms p50 stayed at 0 (23% fresh, against 57% at 30 s yesterday). Full table on #630. The deploy ran --acceptance=game rather than the whole suite: the change moves no tool output, and the database's EBS byte balance was at 68% and falling under other sessions' whole-suite runs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant