Why it matters
Wrong compaction strategy destroys performance. STCS on read-heavy hurts p99; LCS on write-heavy overloads compaction. Understanding which fits which workload is core.
Advertisement
The architecture
STCS (Size-Tiered): merge SSTables of similar size. Write-cheap, read-expensive.
LCS (Leveled): tiered levels; each level 10x larger than previous. Read-cheap (mostly one SSTable per query), write-expensive.
TWCS (Time-Window): buckets by time window. Ideal for time-series with TTL.
Advertisement
How it works end to end
STCS: simple, low overhead. Read amp grows with SSTable count. Good default.
LCS: reads touch few SSTables. Compaction is heavier. Great for read-heavy.
TWCS: buckets = time windows. Old buckets never re-compacted. Perfect for time-series with TTL; dramatically cheaper than STCS/LCS for this workload.