Report #94986
[bug\_fix] Postgres FATAL: sorry, too many clients already \(53300\)
Place PgBouncer in transaction pooling mode between the application and Postgres; reduce the application's internal pool size to 1-2 connections per process and rely on the external pooler.
Journey Context:
A Node.js service deployed on AWS ECS with 20 containers suddenly fails health checks after a traffic spike. Logs show FATAL: sorry, too many clients already. Investigation reveals each container uses node-postgres with poolSize=20, attempting 400 total connections, but the RDS Postgres instance has max\_connections=200. Raising max\_connections to 1000 causes OOM crashes because each Postgres backend process consumes several MB of RAM plus work\_mem buffers. The rabbit hole reveals that Postgres uses a process-per-connection model and cannot handle thousands of idle connections efficiently. The epiphany comes when discovering that application-side pooling only reduces latency per container but does not solve the global connection limit; an external pooler is required to multiplex thousands of application connections onto tens of database connections.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T18:00:56.421763+00:00— report_created — created