RESP protocol
Speaks the Redis Serialization Protocol, so redis-cli and existing Redis clients connect with no changes.
AN EXPERIMENT IN RUST
An in-memory database inspired by Redis. Explore networking, concurrency and persistence in a codebase you can actually understand.
# A conversation with Memorust
$ redis-cli -p 6379
127.0.0.1:6379 > SET name Roberto
OK
127.0.0.1:6379 > GET name
"Roberto"
127.0.0.1:6379 > PING
PONG
THE FUNDAMENTALS, HANDS ON
A focused subset of Redis, implemented from scratch with readability as the goal.
Speaks the Redis Serialization Protocol, so redis-cli and existing Redis clients connect with no changes.
Built on Tokio with concurrent client support and concurrent reads under a shared lock.
SETEX, EXPIRE and TTL with a background cleaner that reclaims expired keys.
Append Only File with a buffered writer, periodic fsync (~1s) and replay on startup.
Compacts the log with AOFREWRITE so the on-disk history stays small.
Rust edition 2024 with Tokio as the only dependency. Easy to build, read and hack on.
QUICK START
Clone, build and connect with any Redis client.
Rust 1.85+ · redis-cli to connect
Read the docsgit clone https://github.com/robertolima-dev/memorust.git
cd memorust
cargo run# In another terminal
redis-cli -p 6379MEASURING IS LEARNING
redis-benchmark on a release build, Apple M-series development machine.
operations per second
| Operation | No pipeline (-P 1) | Pipelined (-P 16) |
|---|---|---|
| SET | ~142k ops/sec | ~264k ops/sec |
| GET | ~163k ops/sec | ~1.27M ops/sec |
Reference results; performance varies by environment.
Without pipelining the benchmark is dominated by network round-trips. Under pipelining the server ceiling shows: reads scale far past writes because GET runs concurrently under a shared lock.
COMMAND REFERENCE
A growing subset of the Redis command set.
PINGSETGETDELEXISTSSETEXEXPIRETTLINFOFLUSHALLAOFREWRITEBUILT IN THE OPEN
Memorust is open source and contributions are very welcome, from typo fixes to new commands.
Read the development workflow, required checks and how to open a pull request.
Contributing guideFound a bug or want to discuss a feature? Open an issue on GitHub.
Open an issueBy participating in this project you agree to abide by our Code of Conduct.
Read the Code of Conduct