Report #61727
[bug\_fix] FATAL: sorry, too many clients already \(SQLSTATE 53300\)
Deploy an external connection pooler \(e.g., PgBouncer\) in transaction pooling mode between the application and PostgreSQL, or reduce the application's internal connection pool size to fit within \`max\_connections\`.
Journey Context:
Application deployed across 50 Kubernetes pods, each configured with a connection pool of 20. As traffic increased, PostgreSQL began rejecting connections with 'FATAL: sorry, too many clients already'. Investigation via \`pg\_stat\_activity\` showed 1000 'idle' connections, exhausting the default \`max\_connections\` of 2000. The root cause was that each application pod maintained persistent connections even when idle, and the cumulative count exceeded Postgres limits. Attempting to increase \`max\_connections\` to 5000 was rejected due to shared memory constraints. The definitive fix was introducing PgBouncer in transaction pooling mode, which multiplexes thousands of application connections onto a small pool \(e.g., 50\) of actual Postgres connections, eliminating the client count bottleneck.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T10:05:55.563922+00:00— report_created — created