Skip to content

NoSQL database (in-memory key-value store) written in Rust

License

Notifications You must be signed in to change notification settings

worthant/HandyDB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HandyDB

Table of Contents

Demonstration 🎥

Screencast-from-2024-01-09-05-15-53.mp4

Description 📝

👋 Welcome to the NoSQL Rust Database project!

🛠 What is it?
The NoSQL Rust Database is a lightweight, high-performance NoSQL database written in Rust. It is designed for efficient data storage and retrieval.

🎯 Purpose of the Database
The purpose of this database is to provide a fast and reliable data storage solution for applications that require NoSQL capabilities. It is optimized for speed and scalability.


📌 Key Features

  • 🖥 Efficient data storage and retrieval.
  • 📊 NoSQL data model for flexible schema.
  • 🔒 High concurrency support.

🚀 Dive in to explore how this works 💻

Technical Requirements

Goal

- Develop in-memory key-value store  
- Use it as a nosql database if needed

📋 Core Components

  • In-memory key-value store.
  • Shard Manager.
  • CLI.
  • Http server

🎨 Design

  1. DashMap - used as a core data structure in kv_store

It's a concurrent implementation of HashMap (manages concurrent access to data).

  1. Transaction support
  2. Tokio - high concurrent multithread runtime enrivonment
  3. Actix-web - highly performant http-server, working in Tokio environment
  4. KvPair model - model for extending simple value functionality with some metadata
  5. Shard model - model of shard, representing kv_stores with DashMap

Sharding model

+-----------------------------------------------------+
| HandyDB Cluster                                     |
| +-----------+   +-----------+   +-----------+       |
| | Shard 1   |   | Shard 2   |   | Shard 3   |       |
| | Port 8081 |   | Port 8082 |   | Port 8083 |       |
| | Shard ID 1|   | Shard ID 2|   | Shard ID 3|       |
| +-----------+   +-----------+   +-----------+       |
|                                                     |
| +-------------------------------------------------+ |
| | Shard Manager (on each shard)                   | |
| | - Knows other shards                            | |
| | - Routes requests based on shard responsibility | |
| +-------------------------------------------------+ |
+-----------------------------------------------------+

How to Use My Project

Just download latest release and execute it

Usage for creating a shard:

./handy_db --port <port> --shard-id [Shard_ID]

Example:

./handy_db --port 32320 --shard-id shardA

Theoretical Materials

  1. Learn rust: Rust book
  2. Concurrency in Rust: Rust book chapter 16
  3. Cassandra nosql db: docs
  4. What is nosql?: 0, 0.5, 1, 2, 3
  5. Rust docs: docs