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 4: System Design & Interview Mastery
maang.io System Design Series
What is this?
You now know Redis from the single-threaded event loop down to the skip list and the 16384 hash slots. This chapter turns that into offer-winning judgment. Interviewers don't want "Redis is an in-memory cache" β they want to see you reach for the right data structure at the right moment, size it, and defend the trade-offs when they push. A candidate who says "I'll use Redis for the leaderboard" is fine; one who says "a sorted set, because it's a skip list plus a hash table, so ZADD is O(log N) and ZSCORE is O(1), and I'll shard by hash tag if it gets hot" is the one who gets the Staff title.
Two parts, matching the Cassandra topic's format: first where Redis fits in real designs (with diagrams), then a mock interview β for each question, what they're really asking, a model answer, and the senior line.
The one-line idea: interviewers use Redis to test whether you can match a data structure to a workload β and whether you understand that its speed comes from living in RAM on one thread, which is simultaneously its superpower and every one of its limits (memory bounds, big-key stalls, and a durability window you must reason about).
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