Code RoomThumbnail request coalescing
MediumPrep Room Coding #3177

Thumbnail request coalescing

System designDistributed systemsMid–Senior~35 min

Design request coalescing for an internal image-thumbnail service. On a cache miss, generating a thumbnail takes ~800ms and is CPU-heavy. During traffic spikes, hundreds of concurrent requests for the same uncached image all trigger generation simultaneously, melting the workers. Design a coalescing layer so only one generation runs per (image, size) while the rest wait and share the result, across a fleet of N stateless app servers.

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.