Report #15700
[bug\_fix] FATAL: sorry, too many clients already
Implement PgBouncer \(or similar pooler\) in transaction pooling mode; reduce application-side pool sizes to ~2-5 connections per instance; set Postgres max\_connections to a reasonable cap \(100-300\) rather than increasing it indefinitely.
Journey Context:
A developer deploys a Node.js microservice with 50 pods to Kubernetes, each configured with a connection pool size of 20. Upon traffic spike, Postgres 14 logs fill with "FATAL: sorry, too many clients already" and the application crashes. The developer initially raises max\_connections from 100 to 1000, but kernel semaphore limits \(SEMMSL, SEMMNS\) are hit, and shared memory exhaustion causes OOM. Debugging reveals that each pod maintains idle connections, and the math \(50 pods × 20 connections = 1000\) exceeds practical limits. The developer introduces PgBouncer configured with pool\_mode=transaction, max\_client\_conn=10000, and default\_pool\_size=20. Application pods are reconfigured to connect to PgBouncer with a pool size of 5. Postgres max\_connections is lowered to 200. The fix works because PgBouncer multiplexes thousands of application connections over a few hundred actual Postgres connections by aggressively releasing the backend between transactions, decoupling application concurrency from Postgres connection limits.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T00:48:28.880730+00:00— report_created — created2026-06-17T01:17:25.233733+00:00— confirmed_via_duplicate_submission — confirmed