10 parts · 12 chapters

Redis and Caching

Redis is a data structure server in memory: strings, hashes, lists, sets, sorted sets and streams, each with operations that run in microseconds. Measured on this machine (Redis 8.6.2): about 170,000 simple operations per second from 50 clients at a median of 0.15 ms, and 1.8 million GETs per second with pipelining.

Ten parts: why Redis; data structures and their memory encodings; the single-threaded core and IO threads; persistence with RDB and AOF; eviction and memory; replication, Sentinel and Redis Cluster; Lua, functions, transactions and pipelining; streams, pub/sub and Redis as a queue; patterns (locks and the Redlock debate, rate limiters, leaderboards, sessions); and operating Redis, including the Valkey fork.

why Redis · data structures and encodings · the single-threaded core · persistence · eviction and memory · replication, Sentinel, Cluster · Lua, functions, transactions, pipelining · streams, pub/sub and queues · patterns · operating Redis and Valkeymid → staff · backend engineers who use Redis for caching, queues or state
structuresStrings, hashes, lists, sets, sorted sets, streams, HyperLogLog, bitmaps, JSON.
the coreOne thread for commands, an event loop, IO threads, and why it is fast.
durabilityRDB snapshots, AOF with fsync policies, and what you can lose.
memorymaxmemory, eviction policies, encodings, fragmentation.
scaleReplicas, Sentinel failover, Cluster with 16,384 hash slots.
patternsCaching, locks, rate limiting, queues, leaderboards, sessions.
Built on Scaling and Distributed SystemsScaling Databases part 4 covered caching patterns; Distributed Systems parts 11 and 12 covered cache invalidation and hash slots. The BYO course built a mini Redis; this course covers the real one.