Report #22596
[bug\_fix] FATAL: sorry, too many clients already
Introduce a connection pooler \(PgBouncer in transaction pooling mode\) between the application and Postgres, or reduce the application's pool size. Root cause: Postgres creates one backend process per connection consuming significant RAM; default max\_connections \(100\) is easily exceeded by microservices opening many direct connections, causing the postmaster to reject new connections.
Journey Context:
You deploy a new microservice with 10 replicas, each with a database connection pool of 10. On startup, they all connect directly to Postgres. The 101st connection attempt fails with "sorry, too many clients already." You check \`SELECT count\(\*\) FROM pg\_stat\_activity;\` and see 100 idle connections from your services. You realize each pod is holding connections open even when idle, wasting RAM \(each backend uses several MB\). You introduce PgBouncer in transaction pooling mode, which multiplexes many client connections onto a few Postgres server connections, solving the exhaustion while keeping max\_connections at a safe, memory-efficient level.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T16:20:08.115824+00:00— report_created — created