Menu

Cassandra Internals: LSM Tree, SSTables, and Compaction
πŸ“°

Cassandra Internals: LSM Tree, SSTables, and Compaction

DEV Community: cassandraΒ·priteshsuranaΒ·8 months ago
#EfoksoBk
#dev#code#strong#class#write
Long article (3880 words) β€” no AI summary yet.
Reading 0:00
15s threshold

Post 3 and 4 traced writes and reads through PostgreSQL and MongoDB. Both engines use B-Tree variants. Both optimize for reads - maintaining sorted indexes, linking leaf nodes, storing heap pointers or link to primary index and pay for that optimization with write complexity: page splits, locking, dead tuples, in-place update overhead.

Cassandra makes the opposite bet. It never modifies anything on disk. Every write is an append. Every file, once written, is immutable until compaction removes it. The read path pays for this. It has to reconcile data across potentially many files to find the latest version of a row. Understanding Cassandra means understanding why that tradeoff is worth making for certain workloads, and how the engine manages the read cost through Bloom filters and compaction.

Why Two Tables instead of One

Before any internals, the schema needs explaining.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.