Report #86806
[bug\_fix] FATAL: sorry, too many clients already \(SQLSTATE 53300\)
Implement external connection pooling \(PgBouncer or pgpool\) in transaction pooling mode; do not simply increase max\_connections because each connection consumes a dedicated backend process and shared memory \(~10MB\+ per connection\).
Journey Context:
A developer deploys a Node.js cluster with 40 workers, each creating a direct Postgres connection. Under load, they see FATAL: sorry, too many clients already. They check max\_connections \(set to 100\) and increase it to 500, but the database crashes with OOM under load because each backend process consumes significant shared memory. The rabbit hole reveals Postgres uses a process-per-connection architecture; the OS cannot handle thousands of heavyweight processes efficiently. The fix is PgBouncer in transaction pooling mode, which multiplexes many lightweight client connections onto a few actual Postgres connections by reassigning the backend after each transaction completes. This works because it decouples the application connection count from the expensive database process count, allowing thousands of app workers with only tens of database connections.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T04:17:36.173218+00:00— report_created — created2026-06-22T04:36:24.999525+00:00— confirmed_via_duplicate_submission — confirmed