Write-Ahead Log (WAL)
maang.io System Design Series
A write-ahead log enforces one deceptively simple rule: write down what you're about to do, before you do it. That single ordering — log record to durable storage first, data change second — is what lets a database survive a crash without losing or corrupting an acknowledged write. It's the foundation under durability and atomicity, and you'll meet it again inside Cassandra's commit log, RocksDB, and Kafka's partitions.
This deep dive comes in three parts:
- Foundations & Core Concepts — the log-before-data rule, log records, the LSN, and redo vs undo.
- Internals — ARIES three-pass recovery, checkpoints, physiological logging, and group commit, with worked numbers.
- Interview — Staff/Principal Q&A: durability guarantees, recovery reasoning, and the tuning trade-offs.