Report #56435
[bug\_fix] PostgreSQL FATAL: sorry, too many clients already
Implement PgBouncer in transaction pooling mode or increase max\_connections in postgresql.conf; ensure application uses connection pooling instead of per-request connections.
Journey Context:
Developer deploys microservice to Kubernetes with 50 pods, each configured with HikariCP pool size of 20. Database immediately throws FATAL errors. Investigation reveals PostgreSQL's max\_connections defaults to 100, and each pod creates 20 actual backend processes. The rabbit hole involves examining pg\_stat\_activity showing hundreds of idle connections from leaked pool connections not closed during rolling updates, understanding PostgreSQL's process-per-connection architecture consumes ~10MB RAM per backend, and realizing individual pod pools fragment the connection limit. The fix works because PgBouncer multiplexes thousands of client connections onto a small pool of actual PostgreSQL backends, eliminating the process-per-connection overhead and preventing exhaustion.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T01:13:12.118021+00:00— report_created — created