System Design Fundamentals [5/15]: B-Trees vs LSM-Trees Explained

Added:

Persistence Problem
Hidden Disk Lies
Write-Ahead Logs
SSD vs HDD
B-Tree Indexing
LSM-Tree Design
Choose Storage Type
Silent Corruption
Distributed Persistence

Persistence Problem

0:00
Playing Section
  • 1

    Data in RAM vanishes when power stops; persistence requires disk storage.

  • 2

    Disk access is extremely slow compared to CPU cycles, creating a core system design tension.

  • 3

    The gap between volatile memory and permanent storage drives database complexity.

Basic understanding of computer memory hierarchy, specifically the latency difference between RAM, SSDs, and HDDs.
Core concepts of tree data structures, such as Binary Search Trees (BSTs) and self-balancing properties.
Fundamental database concepts, particularly the ACID properties (with a focus on Durability) and basic CRUD operations.
The distinction between Sequential I/O and Random I/O operations on physical storage drives.
Analyzing real-world database engine implementations (e.g., InnoDB/PostgreSQL using B-Trees vs. Cassandra/RocksDB/LevelDB using LSM-Trees).
In-depth study of Write Amplification, Read Amplification, and Space Amplification (RUM Conjecture) tradeoffs in storage engines.
Advanced optimization techniques for storage engines, including Bloom Filters, SSTable compaction strategies (Size-Tiered vs. Leveled), and MemTable configurations.
The design of distributed databases and how storage engine selection influences replication, consensus algorithms (like Raft), and sharding.
8.3K views417likes24:43@SeniorEngineer10xOriginal Release: 2026-01-29

This video explains the fundamental trade-off between read and write performance in database systems, revealing that B-Trees optimize for reads by using shallow, fat trees that minimize disk trips (4-5 layers for billions of rows), while LSM-Trees optimize for writes by only performing sequential appends to logs and immutable SSTables, with the ROM Conjecture stating that you can only optimize for two of three: Read, Update, or Memory. The OS hides disk slowness through buffered I/O, but databases must use fsync() for durability, and SSDs have physical constraints like write amplification and limited erase cycles that make sequential writes faster than random writes.