Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What makes CommitLog faster than writing to SSTable in Cassandra ?

I am currently exploring Cassandra in Depth as I am willing to specialize in it. I came across Cassandra "write path" and now trying to understand the Commit Logs. As I understand the write is acknowledged when it is written to the Commit Log, first, then to MemTable ( An in memory table ). But, if commit logs are written to the FILE SYSTEM, so as SSTables. What is the magical thing that makes writing to commit logs faster or as it is stated in many posts and documentations

A write is said to successful once it is written to the commit log and memory, so there is very minimal disk I/O at the time of write

Why it is not written to SSTable and MemTable to be considered successful ?

like image 209
Adelin Avatar asked Feb 09 '23 11:02

Adelin


1 Answers

SSTables are immutable, so appending to them would be impossible. Therefore writes are sent to both a memtable and the commit log (for durability). Under normal operations the memtable is periodically flushed to disk as an SSTable, after which it is compacted with existing SSTables to make reads more efficient. The commit log is only replayed on node restart to recover writes that had not been flushed to SSTables.

like image 198
rs_atl Avatar answered May 21 '23 06:05

rs_atl