Code Room
System designHardsd-g307
Subject CompactionLevel Senior–Staff~45 minCommon in Distributed systems interviewsIndustries Technology, Software development

Question

An LSM store handles ingest fine most of the time, but during traffic bursts foreground reads/writes spike AND compaction has to run to keep the LSM shape healthy — and they fight over the same disk I/O. Symptoms: read p99 spikes during compaction, and occasionally writes STALL entirely because L0 files pile up faster than compaction drains them. Design the compaction scheduler / I/O controller that keeps the tree healthy without letting background compaction starve foreground latency, and explain the dilemma (why you can't just deprioritize compaction).

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.