Skip to content
Mina Samir
Back to projects

2026

Key-Value Store

An in-memory key-value store in Go implementing a documented subset of the Redis protocol (RESP2/RESP3), with lock-protected shards, a bounded worker pool, and a CLI.

Role
Sole author
Timeline
Jul 2026
Team
Solo project

Overview

Personal project: a small in-memory storage engine built to interoperate with Redis clients and to explore protocol design and concurrent connection handling. It does not implement replication or persistent storage.

Challenge

Interoperating with Redis clients while keeping the storage engine small enough to reason about under concurrency: it must speak RESP2 as a fallback for clients that do not negotiate RESP3, must cap concurrent work, and must distribute keys across shards deterministically.

Responsibilities

  • Implemented the RESP2/RESP3 encoder and decoder.
  • Built the TCP server, command dispatcher, and graceful shutdown.
  • Added sharding with a consistent-hash ring and a bounded worker pool.
  • Wrote a bundled CLI client that reuses the same client library.

Solution

Implemented a documented RESP2/RESP3 subset, an in-memory store, and a bounded worker pool for concurrent request handling.

Architecture

Go. internal/resp codec, internal/server (TCP listener, handler, worker pool), internal/store (thread-safe shards and consistent-hash ring), cmd/kvs-cli client.

Technical decisions and trade-offs

  • Implemented RESP3 with automatic fallback to RESP2 behind a HELLO negotiation, so modern clients get richer types without breaking older ones.
  • Distributed keys with a consistent-hash ring rather than modulo hashing, so adding a shard remaps only a fraction of keys.
  • Used a fixed worker pool to limit concurrent work; throughput and memory use have not been benchmarked.

Outcomes

  • PING, SET, GET, DEL, INCR, and HELLO implemented and documented in the README with a runnable server and CLI.
  • Server flags for port and shard count, with concurrency bounded by a fixed worker pool.

Technologies

  • Go
  • TCP
  • RESP
  • Concurrency