Systems Programming

mini-redis

mini-redis is a Redis-inspired key-value store built in C++. I made it to understand the mechanics behind a real systems tool by implementing a smaller version from scratch: networking, parsing, persistence, recovery, TTL, eviction, testing, and benchmarks.

  • C++
  • TCP Server
  • Append-only log
  • TTL
  • LRU-style eviction
37,410

ops/sec on the normal generated-value run from the README benchmark snapshot.

TTL

Expiration is wired through the full command path, not bolted on afterward.

Recovery

State comes back on restart by replaying the append-only persistence log.

Why I built it

Building a smaller version from scratch made the tradeoffs much more concrete: what has to happen between a line of client input and a durable state change, how eviction affects behavior, and where a simple protocol starts to show strain.

That hands-on path taught me more than reading about the design alone. It forced me to think about correctness, state recovery, concurrency, and performance together.

System Diagram

mini-redis system diagram

Architecture

1

Accept commands

The TCP server accepts command input from connected clients on localhost.

2

Parse input

The parser translates text commands into a structured internal representation.

3

Apply state changes

The executor updates the key-value store, including TTL handling and delete paths.

4

Persist mutations

Mutating commands are written to the append-only log so the server can recover state.