Reduce pool size and deployment surge to prevent PG connection exhaustion (#94)

PG max_connections=100 (97 usable). With pool_size=15 and maxSurge=100%,
rolling deploys briefly run 4 pods × 15 = 60 pool connections plus Oban
notifiers, exceeding the limit and causing too_many_connections errors
that cascade into ssl recv: closed timeouts.

- pool_size: 15 → 10 (steady state: 2×10=20, deploy: 3×10=30)
- maxSurge: 100% → 1 (max 3 pods during rollout instead of 4)

Reviewed-on: graham/towerops-web#94
This commit is contained in:
Graham McIntire 2026-03-20 10:39:52 -05:00 committed by graham
parent b77950aed6
commit 071729f65c
2 changed files with 2 additions and 2 deletions

View file

@ -322,7 +322,7 @@ if config_env() == :prod do
config :towerops, Towerops.Repo,
ssl: ssl_config,
url: database_url,
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "15"),
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"),
# Proactively ping idle connections every 1s to detect dead SSL connections
# before they're handed to a real query. Without this, a dead connection
# sits in the pool until a query checks it out and hangs for the full timeout.

View file

@ -8,7 +8,7 @@ spec:
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 100% # Start all new pods at once for fast rollouts
maxSurge: 1 # Limit to 3 pods during rollout to avoid exceeding PG max_connections
maxUnavailable: 0 # Keep all pods running during rollout
minReadySeconds: 10 # Wait 10s after pod is ready before considering it available
selector: