Report #66275
[bug\_fix] PostgreSQL FATAL: sorry, too many clients already
Deploy PgBouncer \(or a similar connection pooler\) in transaction pooling mode between the application and PostgreSQL. Configure the application to connect to PgBouncer instead of directly to Postgres. PgBouncer multiplexes many lightweight application connections onto a small, fixed pool of actual PostgreSQL backend processes, avoiding the \`max\_connections\` limit.
Journey Context:
Your Node.js microservices on Kubernetes start failing with \`FATAL: sorry, too many clients already\` during rolling deployments. You check \`pg\_stat\_activity\` and see hundreds of \`idle\` connections from old pods that didn't shut down cleanly. Your \`max\_connections\` is set to 100, and with 15 pods each having a pool of 10, you exhaust the limit. You consider raising \`max\_connections\` to 500, but read that each connection consumes significant shared memory and process overhead. Instead, you deploy PgBouncer as a sidecar in transaction pooling mode. You point your app at \`localhost:6432\` \(PgBouncer\) instead of the Postgres port. Now your apps think they have hundreds of connections, but PgBouncer maintains only 20 actual Postgres connections, reassigning them after each transaction. The 'too many clients' errors disappear, and your database memory usage remains stable.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T17:43:24.815503+00:00— report_created — created