Code Room
System designHardsd-g295
Subject Lsm treeLevel Senior–Staff~45 minCommon in Algorithms & data structures interviewsIndustries Technology, Software development

Question

Design the compaction and reclamation strategy for an LSM-backed store of short-lived data: a session/event store where every row has a TTL of 24–72 hours and is then deleted, sustained ingest of 300k writes/sec, and reads only ever touch recent data (last few hours). The naive setup leaves expired rows and tombstones on disk for days, so disk usage is several times the live dataset and reads slow down wading through dead data. Design how data is laid out and compacted so expired data is reclaimed promptly and read amplification stays low.

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.