Why it matters

Write path is where Cassandra's speed comes from. Understanding it helps tune commit log sync, memtable size, and flush behavior.

Advertisement

The architecture

Client sends write to coordinator. Coordinator forwards to replicas per CL.

Each replica: append to CommitLog (fsync per periodic or per batch), apply to MemTable in memory. Ack coordinator.

Write path stagesCommitLogdurability, append-onlyMemTablein-memory sortedSSTable flushimmutable fileNever modifies data in place; compaction later merges SSTables
Cassandra write flow.
Advertisement

How it works end to end

MemTable flush: when MemTable reaches threshold (128 MB default), flush to a new SSTable on disk. SSTable is immutable; sorted; has bloom filter.

Compaction: periodically merge SSTables to reclaim tombstoned space and reduce SSTable count. Different strategies: STCS, LCS, TWCS for different workloads.

Commit log sync policy: periodic (10 seconds default) or batch (per group). Trade durability vs throughput.