Code Room
System designMediumsd-g061
Subject Request coalescingLevel Mid–Senior~35 minCommon in Distributed systems interviewsIndustries Technology, Software development

Question

Design a batching/coalescing layer in front of a downstream data store to fix an N+1 query explosion: a GraphQL/page-render layer issues thousands of single-key lookups (getUser(id)) per request burst, and each becomes its own round trip, saturating the database. Design a layer that automatically batches concurrent single-key reads into multi-key fetches and deduplicates repeated keys, without the callers changing their code much.

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.

Narrate your design
Loading whiteboard…
Run or narrate your approach, then ask the coach.