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.

Compaction strategiesSTCSwrite-heavy defaultLCSread-heavy, level tiersTWCStime-series + TTLMatch strategy to workload; wrong choice causes major performance issues
Three compaction strategies.
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.