A Source-Code-Oriented Guide
REDIS
INTERNALS
Programming ideas behind the code: the event loop, the object encodings, the incremental rehash, the fork-and-forget snapshot — the small, clever decisions that make Redis fast, simple, and predictable. Chalk it up, one board at a time.
A warm, hand-drawn chalkboard illustration for the cover of a programming book called "Redis Internals": a dark slate-green chalkboard background with a single glowing circular loop (an event loop) drawn in chalk-white, orbited by three small simple chalk-drawn icons evenly spaced around its circumference — a key-and-value tag, a small clock face, and a stack of disks (representing persistence) — connected to the loop by thin dashed chalk lines. Soft pastel chalk colors only: chalk-white, warm gold, dusty blue, sage green, soft pink — no other colors. A light scatter of chalk dust and faint eraser smudges near the bottom edge for texture. Flat, hand-drawn, illustrative style like real chalk on slate (not photorealistic), no text or lettering baked in, generous empty margins. Target size ~1280x720px, 16:9 landscape; compose for a small on-page figure with the subject centred and safe margins — it is letterboxed into a 16:9 box, so keep nothing important near the edges.
Generate this with your image agent, then drop the file here.
Contents
- What Redis Is Really Optimizing For start here
- The Event Loop: One Thread, Thousands of Clients the ae library
- Anatomy of a Request: Socket to Reply the full trip
- The Object Model: One Struct, Many Encodings robj & strings
- Collections in Disguise: Lists, Hashes, Sets, Sorted Sets compact by default
- Dictionaries and Incremental Rehashing no stop-the-world resize
- Command Dispatch and Atomicity Without Locks MULTI, Lua, modules
- Persistence: RDB Snapshots and the Append-Only File fork & forget
- Replication and Clustering: Scaling Beyond One Box PSYNC & hash slots
- Expiration, Eviction, and the Housekeeping Cron good-enough, cheaply
- Why Redis Is Fast (and How to Watch It) slowlog & friends
- How to Reason Like a Redis Engineer patterns to steal
- The Cheatsheet encodings, tradeoffs, glossary
Use → and ← to turn pages,
↑ to jump back here. Every chapter opens with a runnable
redis-cli example before it explains the C code underneath —
that's the whole point of this book: Redis is small, readable, clever software,
and the goal is to leave you itching to go build something of your own.