Report #60562
[bug\_fix] FATAL: sorry, too many clients already \(53300\) – connection limit exhaustion
Place PgBouncer \(transaction pooling mode\) between apps and Postgres, or reduce per-instance connection pool sizes so total app connections is less than max\_connections minus superuser\_reserved\_connections. Do not merely raise max\_connections without increasing kernel SHM limits.
Journey Context:
A developer deploys five microservices, each configured with a HikariCP pool of 20 connections, against an RDS db.t3.medium with max\_connections=100. The fourth deployment fails with FATAL errors. The developer increases max\_connections to 500, but Postgres fails to restart because kernel.shmall is too low. After researching, they realize each idle connection consumes shared memory. They deploy PgBouncer in a sidecar, configuring apps to connect to PgBouncer with a pool of 20, while PgBouncer maintains only 10 actual Postgres connections. This works because PgBouncer multiplexes many app sessions onto few backend processes, avoiding the hard connection limit.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T08:08:34.606716+00:00— report_created — created