The project's README from github.com/barddoo/zedis. As one markdown file: README.md.
A Redis-compatible in-memory data store written in Zig, designed for learning and experimentation. Zedis implements the core Redis protocol and data structures with a focus on simplicity, performance, and thread safety.
Not intended for production use yet.
DEL, EXISTS, TYPE, TTL, EXPIRE, KEYS),
strings, lists (LPUSH/RPUSH/LRANGE, ...), and RANDOMKEY.maxmemory with eviction, -OOM rejection
for allocating commands, and cgroup-aware auto-sizing inside containers.SELECT. It adds complexity and segment memory. This follows the reasoning Salvatore Sanfilippo gave when he called Redis multiple databases one of his worst design decisions.Download the binary from the releases page or build from source to get started with Zedis.
build.zig.zon)# Clone the repository
git clone https://github.com/barddoo/zedis.git
cd zedis
# Build the project (optimized, ReleaseFast)
zig build --release=fast
# Run the server
zig build run --release=fast
The server will start on 127.0.0.1:6379 by default.
You can test Zedis using the standard redis-cli or any Redis client:
# Connect to Zedis
redis-cli -h 127.0.0.1 -p 6379
# Try some commands
127.0.0.1:6379> SET mykey "Hello, Zedis!"
OK
127.0.0.1:6379> GET mykey
"Hello, Zedis!"
127.0.0.1:6379> INCR counter
(integer) 1
127.0.0.1:6379> TYPE mykey
string
Pre-built images are available on Docker Hub:
docker run -p 6379:6379 barddoo/zedis
| Tag | Base | Notes | Use case |
|---|---|---|---|
latest, x.x.x, x.x.x-debian, x.x.x-slim |
Debian Trixie slim | Larger, glibc base | Default; broader ecosystem |
x.x.x-alpine, alpine |
Alpine 3.20 | Smallest with shell | Size-sensitive deployments |
x.x.x-distroless |
Distroless static | No shell | Security-sensitive |
Mount a volume to persist data across restarts:
docker run -p 6379:6379 -v zedis-data:/var/lib/zedis/data barddoo/zedis
docker run -p 6379:6379 -v ./zedis.conf:/etc/zedis/zedis.conf barddoo/zedis
The codebase is split by responsibility:
src/app/ — server lifecycle, client connections, config, clocksrc/storage/ — store, KV allocator, lists, time series, Bloom filters, searchsrc/commands/ — command handlers and registrysrc/persistence/ — AOF and RDBsrc/protocol/ — RESP parser and serializersrc/util/ — mailbox, stack writer, types, compressionsrc/benchmarks/ — micro/load benchmarksSee docs/server-architecture.md for the current server thread model and request flow.
See docs/memory-architecture.md for the current allocator layout, memory budgets, and runtime allocation behavior. See docs/store-cache-layout.md for the store's hash-table layout and cache behavior.
# Build in debug mode (default)
zig build
# Build optimized release (ReleaseFast; use this for benchmarks and performance testing)
zig build --release=fast
# `--release` with no mode also picks ReleaseFast (the preferred mode in build.zig)
zig build --release
# Run the full test suite
zig build test
# Run a focused subset
zig build test -Dtest-filter="Store"
# Format the source
zig fmt .
This project was developed with some AI help. Most of the code was written by hand.
Contributors are welcome! Whether you're fixing bugs, adding features, improving documentation, or suggesting enhancements, your contributions are appreciated.
Feel free to:
Check out the open issues to see where you can help.