Every distributed database and event streaming broker—whether PostgreSQL, MySQL, Apache Kafka, or RocksDB—ultimately relies on persisting state to physical storage media. A naive mental model treats a disk as a simple byte array with uniform write times. In reality, modern NVMe SSDs are complex distributed systems in their own right, featuring multi-core controllers, DRAM write buffers, and NAND flash physics requiring out-of-place writes.

This module deconstructs the hardware and operating system storage path:

  • NAND Flash & Write Amplification: How flash memory pages () and erase blocks () dictate sequential vs. random write performance and drive SSD wear.
  • The Linux Page Cache: Dirty page buffering, dirty background writeback heuristics, and the trade-off between write throughput and crash recovery windows.
  • Durability Guarantees: Why write() does not guarantee persistence, and the precise mechanical cost of fsync, battery-backed NVMe write caches, and Power Loss Protection (PLP).

What you will learn

  • Deconstruct NAND flash memory physics: pages, erase blocks, out-of-place updates, garbage collection, and write amplification
  • Analyze Linux kernel page cache write buffering: pdflush/flusher threads, dirty_ratio vs dirty_background_ratio, and data loss windows
  • Distinguish fsync(2), fdatasync(2), and sync_file_range(2) execution semantics and latency penalties on enterprise NVMe SSDs
  • Evaluate the trade-offs of kernel-bypass direct I/O (O_DIRECT) vs. buffered I/O in high-performance databases (PostgreSQL, RocksDB, ScyllaDB)
STAGE TOPICS

Topics in this chapter