</> MAANG.io
system design · 201

Intermediate

Master system design interviews with scalable architecture patterns, distributed systems, and real-world design challenges.

0/124 solved 0% complete

Redis

maang.io System Design Series


Redis is an in-memory data-structure server: not just a cache, but a toolbox of strings, hashes, lists, sets, sorted sets, streams, and more, served from RAM by a single-threaded event loop in sub-milliseconds. Add persistence (RDB/AOF), replication, and cluster sharding, and it becomes the swiss-army knife behind caches, rate limiters, leaderboards, queues, and session stores.

This deep dive comes in four parts:

  • Foundations & Core Concepts — the data types and the single-threaded model.
  • Internals — persistence (RDB/AOF), replication, and Redis Cluster hash slots, with worked numbers.
  • Advanced Internals — eviction, pipelining, transactions, and Lua scripting.
  • Interview — Staff/Principal Q&A: use-case fit, persistence trade-offs, and scaling.

Redis — Part 3: Durability, Replication & Cluster

maang.io System Design Series


What is this?

Our counter clerk is fast because everything lives on the counter, in reach — in RAM. But RAM has a terrifying property: pull the plug and the whole counter is wiped. A single clerk is also a single point of failure — if they go home sick, the shop is shut. And one counter can only hold so many bins before the wall runs out of space. Part 3 is about growing up from "one brilliant clerk at one counter" into a shop that survives crashes, keeps working when a clerk falls over, and spans a whole building.

Three problems, three answers: persistence (write the counter's contents to a ledger so a crash isn't fatal), replication + Sentinel (train understudies who copy the head clerk and can take over), and Cluster (many counters, each owning a slice of the bins). Plus the humble but vital job of eviction — deciding what to throw away when the wall is full. Let's take them in order.

The one-line idea: Redis makes durability, availability, and scale into dials you turn, not defaults you inherit. You choose how much data you can afford to lose (RDB vs AOF), how failover happens (Sentinel), how you shard (Cluster's 16384 slots), and what gets evicted under pressure (LRU/LFU/TTL) — and each dial is an explicit trade of performance for safety.


Sign in to continue reading

The rest of this lesson is available with a free account. Signing in with Google or Microsoft is free.

Sign in to read the full lesson

Sign in to MAANG.io

Use your Google or Microsoft account — no password to remember.

Continue with Google Continue with Microsoft

Please accept the terms above to continue.