Question
Design the LSM-tree storage engine for a time-series metrics database ingesting 4M data points/sec across 50k active series, with a read pattern dominated by recent-window range scans (last 1h) but occasional historical scans over 90 days. Writes are append-heavy and roughly monotonic in timestamp per series; the SLA is sub-50ms p99 for recent-window reads and bounded disk usage with a 14-day hot tier on NVMe and a cold tier on object storage. Walk through the memtable/SSTable layout, the compaction strategy, and how you keep read amplification low for recent windows while controlling write amplification.
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.