Report #45070
[bug\_fix] FATAL: sorry, too many clients already
Implement external connection pooling \(PgBouncer in transaction mode\) or drastically reduce per-instance pool size while increasing max\_connections cautiously. Root cause: Postgres connections are heavy OS processes; without an external pooler, horizontal scaling of app servers multiplies connections linearly, quickly exhausting the default 100 limit.
Journey Context:
A Node.js API on ECS scaled from 2 to 8 tasks and immediately began throwing FATAL errors. Developers suspected a connection leak, but pg\_stat\_activity showed 100 idle connections—exactly the max\_connections default. Each Node.js instance defaulted to a pool of 10. The rabbit hole revealed that pool size × horizontal scaling = 80 connections, plus monitoring tools, exceeded the limit. They tried increasing max\_connections to 200, but hit OS file descriptor limits and memory pressure. The real fix was introducing PgBouncer in transaction pooling mode, allowing thousands of logical connections while keeping physical Postgres connections under 50.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T06:07:07.815173+00:00— report_created — created