crabdis

Crates.iocrabdis
lib.rscrabdis
version0.1.23
created_at2024-03-11 00:58:09.777959+00
updated_at2025-06-19 12:57:54.550421+00
descriptionIt's like Redis but a bit rusty...
homepagehttps://github.com/pxseu/crabdis#readme
repositoryhttps://github.com/pxseu/crabdis
max_upload_size
id1169073
size137,543
Kuba Ellwart (pxseu)

documentation

README

crabdis

It's like Redis but a bit rusty...

What?

This is a simple in-memory key-value store written in Rust. It's somewhat compatible with Redis via the RESP protocol, but it's not a drop-in replacement. A lot of commands are missing and stuff might not work as expected.

Please don't use this in production. Or do, I'm not your mom. But don't blame me if it eats your data.

Why?

I wanted to write Redis but multi-threaded and in Rust. This is the result. Works? Kinda. Is it good? Maybe. Is it fast? Yes.

Installation

You can find binaries on the releases page. Or you can build it yourself with cargo build --release.

If you want to install it with cargo, you can do so with cargo install crabdis.

There is also a Docker image available on Docker Hub.

Usage

crabdis

TODO / Missing Features

  • Basic RESP protocol implementation
  • GET, SET, DEL, EXISTS, KEYS, FLUSHDB
  • COMMAND / COMMAND DOCS (so ioredis works)
  • SET arguments (EX, PX, NX, XX) + SETEX, PSETEX
  • Hash Command family (HGETALL, HSET)
  • Pub/Sub support (PUBLISH, SUBSCRIBE, UNSUBSCRIBE)
  • Additional commands (INCR, MGET, MSET, TYPE, SCAN, SELECT, RENAMENX, INFO, HELLO)
  • Persistence
  • More Hash commands (HGET, HDEL, etc.)
  • List commands
  • Set commands
  • Sorted Set commands

This will start the server on 127.0.0.1:6379. You can change the address and port with the --address and --port flags.

Benchmarks

Below are micro-benchmarks for core Value operations and RESP serialization/deserialization (run with cargo bench).

File Operation Time (ns)
value_benchmarks.rs create_string 16.15
create_integer 2.14
create_multi 54.0
create_map 105.3
is_some 0.581
is_none 0.443
inner 20.0
value_resp2_benchmarks.rs resp2_serialize_string 161
resp2_serialize_integer 102
resp2_serialize_nil 54
resp2_serialize_multi 511
resp2_serialize_map 844
resp2_serialize_expire 97
resp2_deserialize_string 294
resp2_deserialize_integer 228
resp2_deserialize_nil 232
resp2_deserialize_multi 598
value_resp3_benchmarks.rs resp3_serialize_map 805
resp3_serialize_set 503
resp3_serialize_push 591
resp3_serialize_error 188
resp3_deserialize_map 826
resp3_deserialize_set 532
resp3_deserialize_push 568
resp3_deserialize_error 269

Total (sum of all measured times): ≈ 7602 ns

(Lower is better. All times are approximate and measured on a Mac, see benches/ for details.)

License

This project is licensed under the MIT License.

Commit count: 69

cargo fmt