Module 02: Persistence & Durability

Welcome to Module 2 of the Redis Mastery course. In this module, we will explore how Redis ensures your data survives restarts, crashes, and power failures.

Many developers treat Redis purely as a cache, but it is a fully durable database when configured correctly. We will dive deep into the internals of how Redis writes to disk, the operating system mechanisms involved (fork, fsync), and how to tune these for your specific needs.

1. Module Contents

1. RDB Snapshotting

Learn how Redis takes point-in-time snapshots of your dataset using the fork() system call and Copy-On-Write (COW). We’ll visualize memory usage during snapshots and discuss the “stop-the-world” risks.

2. AOF Append Only

Discover the Append-Only File (AOF) log, which records every write operation. We’ll explore fsync policies (always, everysec, no) and how AOF rewrites prevent logs from growing forever.

3. Hybrid Persistence

Why choose between fast startups (RDB) and high durability (AOF)? Learn about Hybrid Persistence, the modern standard that combines the best of both worlds.

Review & Cheat Sheet

Test your knowledge with flashcards, review key takeaways, and grab a quick reference cheat sheet for production configurations.


2. Prerequisites

  • Basic understanding of Redis data structures (Module 01).
  • Familiarity with basic Linux concepts (processes, memory) is helpful but not required.

3. Learning Objectives

By the end of this module, you will be able to:

  • Configure RDB and AOF based on your data safety requirements.
  • Explain the memory implications of BGSAVE and COW.
  • Troubleshoot slow startups and large AOF files.
  • Implement a robust backup strategy for your Redis cluster.