Rusdis is a lightweight, high-performance, in-memory key-value store built from scratch in Rust. It mimics the basic functionalities of Redis, with a focus on simplicity, performance, and leveraging Rust's safety guarantees.
- In-Memory Storage: Fast data retrieval using an in-memory architecture.
- Key-Value Operations:
SET
andGET
commands for storing and retrieving values.DEL
for deleting keys.
- Data Persistence:
- Append-only file (AOF) support for durable storage.
- Periodic snapshots using a custom implementation of RDB-like persistence.
- Concurrency: Multi-threaded request handling using Rust's async capabilities.
- Customizable: Configurable memory limits, persistence intervals, and more.
- Extensible: Modular design allows easy extension of features.
- Rust (minimum version: 1.77.0)
-
Clone the repository:
git clone https://github.com/your-username/rusdis.git cd rusdis
-
Build the project:
cargo build --release
-
Run the server:
cargo run --release
-
Use any Redis-compatible client (e.g.,
redis-cli
):redis-cli -h 127.0.0.1 -p 6379
SET key value
GET key
DEL key
port
: Port number for the server (default:6379
)dir
: Directory to store RDB filedbfilename
: Name of the RDB filereplicaof
: Master's port number to listen to
cargo run --release -- --dir /path/to/rdbfile --dbfilename backup.rdb --port 6380 --replicaof 6379
- Storage Engine: Implements a hash map for fast key-value access, with optional expiration times.
- Persistence:
- AOF: Logs all write operations for recovery after restarts.
- Snapshots: Periodic full-disk dumps of the in-memory state.
- Networking: Uses
tokio
for asynchronous request handling. - Command Parser: Parses Redis-like commands from clients.
- Add support for pub/sub functionality.
- Implement clustering for horizontal scaling.
- Introduce more advanced data structures like lists, sets, and sorted sets.
- Enhance security with authentication mechanisms.
- Improve AOF compression and performance.