Pranit PatilMumbai IST
All work

Systems · Jan 2026

Small-Redis

A Redis-compatible database in Go, built on an LSM tree.

01The problem

Key-value stores are easy to use and hard to understand. The goal was to learn how a storage engine stays fast on writes and survives a crash, by building one from scratch.

02What I built

  1. 01

    A TCP server that speaks RESP, Redis's wire protocol, so redis-cli and ordinary clients like redis-py and ioredis work against it unchanged.

  2. 02

    An LSM-tree engine. Writes land in an in-memory memtable, which turns immutable and is flushed to sorted SSTable files on disk.

  3. 03

    A write-ahead log, so every write is recorded before it's applied and replayed after an unclean shutdown.

  4. 04

    Compaction that merges SSTables to keep reads fast and disk use down, with tombstones for deletes. About 1,600 lines of Go in all.

  • Go
  • RESP protocol
  • LSM tree
  • Write-ahead log

03Outcome

Supports PING, ECHO, SET, GET and DEL, survives restarts and loads its SSTables on startup. I also reviewed my own code and keep an issues log, including two race conditions to fix next.

Next projectDataBotAsk a Postgres database questions in plain English, get charts back