Skip to content
Select theme

Build a Redis clone

What you end up with: a server that speaks RESP well enough for redis-cli to connect, supports strings, lists and expiration, persists its data, and survives a restart.

What the finished server bench looks like

This is the classic “learn networking and concurrency properly” project. The protocol is small enough to implement in a day, and the hard parts — concurrent access, cleanup, persistence — are the parts that teach you the most.

  • A TCP server that parses and writes RESP
  • Concurrent clients with Tokio tasks and a shared, sharded store
  • Commands: PING, SET, GET, DEL, EXPIRE, TTL, LPUSH, LRANGE
  • Key expiration, sweeping without blocking the server
  • Append-only file persistence, replayed on startup
  • Replication: a replica that follows a primary
  • Integration tests that drive the server over a real socket

Smart pointers and memory for Arc and interior mutability, then Concurrency and async all the way through. Do not start this track before async feels comfortable.