Redis: one thread, many jobs
Redis turns up in nearly every design as a cache, a counter, a leaderboard, a lock or a little queue, and each of those uses leans on the same two facts: every command runs alone on one thread, and the data lives in memory first and on disk second.
What you'll be able to do
- Explain why a single-threaded command loop makes each Redis command atomic, and what it costs you
- Pick the Redis data structure that matches a job, and state its complexity
- Say exactly what data you lose on a crash under RDB, AOF, and asynchronous replication
- Plan a Redis Cluster key layout that avoids cross-slot errors, hot keys and big keys
Before this: caching-and-stampedes
Log in to read the rest of this lesson
Redis turns up in nearly every design as a cache, a counter, a leaderboard, a lock or a little queue, and each of those uses leans on the same two facts: every command runs alone on one thread, and the data lives in memory first and on disk second. This walkthrough runs about 22 minutes, with runnable code you can edit and re-run as you read. A new account gets 7 days of Pro free, no card required.
Log in to continueThe first module of every track is free to read on the web: see what's open in System design.