Memfast is a blazing-fast, memory-efficient in-memory key-value store built in Rust. Designed for caching and inference workloads, it offers low-latency access and high throughput with a lean binary TCP protocol. Perfect for speeding up AI pipelines or any application needing rapid key-value operations.
- High Performance: Lock-free sharded storage with
dashmap
and async I/O viatokio
. - Memory Efficiency: Uses
jemallocator
and LRU eviction to optimize RAM usage. - Simple Protocol: Custom binary TCP for minimal overhead.
- Configurable: Specify host and port at startup.
- Rust (latest stable, e.g., via
rustup
)
- Clone the repo:
git clone https://github.com/Think-a-Tron/memfast.git cd memfast
- Build:
cargo build --release
Start with default settings (127.0.0.1:3524
):
cargo run --release
Or specify a custom host and port:
cargo run --release -- --host 0.0.0.0 --port 6969
Check available options:
cargo run --release -- --help
memfast
uses a binary TCP protocol:
- PUT:
[1] [key_len: 2] [key] [val_len: 4] [value]
→[status: 1]
(0
=success,2
=memory full) - GET:
[0] [key_len: 2] [key]
→[status: 1] [val_len: 4] [value]
(if0
) or[1]
(not found) - DELETE:
[2] [key_len: 2] [key]
→[status: 1]
(0
=success,1
=not found)
Keys and values are raw bytes; key length is capped at 65KB, value length at ~4GB.
Fork, tweak, and submit PRs! Issues and feature requests are welcome on GitHub.