Code RoomConnection pool exhaustion after autoscale
HardPrep Room Coding #4543

Connection pool exhaustion after autoscale

On-callCode quality & reviewSenior–Staff~35 min

A fleet of 60 stateless API pods (Node.js) each holds a Postgres pool of 20 connections. After an autoscaling event scaled the fleet from 30 to 60 pods during a traffic spike, the database starts rejecting new connections with 'FATAL: sorry, too many clients already' (Postgres max_connections = 500). API error rate spikes. The DBA refuses to raise max_connections further because each Postgres backend costs ~10MB and CPU context-switching is already high. Triage and propose both the immediate fix and the right architecture.

What a strong answer looks like

Stop the bleeding first (mitigate), then form hypotheses from real signals. Separate root cause from symptom, communicate status as you go, and close with what prevents a repeat.

0:00 of about 35 min
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.