Code RoomLeader election for stream partitions
HardPrep Room Coding #3325

Leader election for stream partitions

System designDistributed systemsSenior–Staff~45 min

Design leader election for a sharded stream-processing system where each of 4,000 partitions must have exactly one active processor writing to a downstream sink. Processors run on autoscaled, preemptible VMs that can pause (GC, network partition) for tens of seconds. A second processor must never write the same partition's output concurrently, even if the 'old' leader is merely slow and not dead. How do you elect leaders and guarantee single-writer at the sink?

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.

Clarify5:00 left
Estimate5:00 planned
Design15:00 planned
Deep dive12:00 planned
Failure8:00 planned
0:00
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.