Loading...
Loading...
Redis feels like a black box until you build a tiny version yourself. You start with a program that just listens on a port. By the end, the same program speaks the real Redis language, remembers data after a restart, and a backup machine quietly mirrors it. Every line is plain Python you can read in one sitting. No frameworks. No magic.
Engineers are learning here from
Build your own Redis in Python, starting from a blank file. You will write a tiny server that listens on a port, then teach it the same language real Redis clients speak, then give it memory, then teach it to remember after a restart, then let many readers subscribe to one writer. By the end you will have a working stand-in for Redis you understand line by line. Each step is one short Python file you can read in one sitting, and the difference between any two steps is the new idea you just learned.
Write your own Redis in Python, one short file at a time. Sockets, the wire language, the store, expiry, persistence, fan-out, and a backup machine. Every line is yours to read.
What you'll ship
What you'll learn
Curriculum
Network and protocol
Open a TCP port, read bytes from a client, and learn the Redis wire format (RESP) from scratch.
Store and expiry
In-memory KV with command dispatch. Then EXPIRE, TTL, and lazy deletion via a sidecar dict.
Durability: AOF and RDB
Append-only logs for crash safety. Point-in-time snapshots for fast recovery. The two pillars of Redis persistence.
Messaging and replication
Pub/Sub fan-out and master/replica log shipping. Same RESP wire format underneath both.
Scaling: Event loop and benchmark
Replace one-thread-per-client with selectors-based non-blocking IO. Then measure how close (or far) you get from real Redis.
Who it's for
You ship features that use Redis but you would freeze if asked to explain how it works in a system design interview.
You have built CRUD APIs and want a project that teaches sockets, protocols, persistence, and concurrency in one stack.
You want to read the real Redis source code without getting lost. Building a smaller version first makes the navigation easy.
FAQ
No. The workshop ships its own server. Real Redis is useful as a comparison in the final benchmark step, but optional everywhere else.
Python keeps the focus on shape. Sockets, dicts, parsing logic are all in the standard library. Step 10 measures the gap to real Redis and explains exactly what changing the implementation language would buy you.
The wire protocol is real RESP, so redis-cli connects and works for the commands we implement. The command coverage is small (SET, GET, DEL, EXISTS, EXPIRE, TTL, KEYS, SUBSCRIBE, PUBLISH, REPLICAOF, SAVE). Production Redis has dozens more.
That book is in C. This course is in Python with a slightly different progression (pub/sub and replication land before the event loop). Both are valid paths. The Python version is faster to read and modify.
Write your own Redis in Python, one short file at a time. Sockets, the wire language, the store, expiry, persistence, fan-out, and a backup machine. Every line is yours to read.