Code RoomConnection pool coordinator
MediumPrep Room Coding #3752

Connection pool coordinator

System designConcurrencyMid–Senior~35 min

Design a shared connection-pool / concurrency-permit coordinator that fairly multiplexes a hard cap of database connections (say 200) across dozens of service instances and many request types, so that one bursty endpoint can't exhaust the pool and starve the rest. Constraints: total in-flight DB connections must stay under the cap, a slow query must not let callers pile up unbounded, and waiting callers should be served fairly with a bounded timeout. Describe how permits are allocated, how concurrent callers coordinate, and the overload behavior.

What a strong answer looks like

Clarify scale and constraints first. Propose a clean component breakdown, then go deep on the hard parts (data model, bottlenecks, consistency, failure modes) and name the trade-offs you are making.

Clarify4:00 left
Estimate4:00 planned
Design11:30 planned
Deep dive9:30 planned
Failure6:00 planned
0:00
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.