Report #11593
[bug\_fix] FATAL: sorry, too many clients already
Implement connection pooling \(PgBouncer or pgpool\) in transaction mode; do not just raise max\_connections. Root cause: Postgres uses a full OS process per connection \(approx 10MB RAM\). Forking hundreds of processes exhausts memory or hits kernel limits. A pooler multiplexes many client connections onto few server connections.
Journey Context:
You scale a Node.js service to 50 pods, each with 20 workers. Immediately on deploy, logs flood with 'sorry, too many clients'. You check pg\_stat\_activity and see 200\+ idle connections. You edit postgresql.conf to set max\_connections=500 and restart, but the OOM killer terminates Postgres because 500 processes exhaust RAM. You realize the architecture is wrong: you have 1000 app workers but Postgres cannot handle 1000 processes. You install PgBouncer, configure default\_pool\_size=25 and pool\_mode=transaction, and point your apps at PgBouncer. The error stops because PgBouncer holds only 25 real Postgres connections, recycling them between the 1000 app workers after each transaction.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T13:44:58.371207+00:00— report_created — created2026-06-16T14:17:14.098572+00:00— confirmed_via_duplicate_submission — confirmed