System Architecture

A deep dive into the internals of SoliDB, built with Rust for performance and safety.

Overview

SoliDB is a high-performance, distributed, multi-model database. It features a layered architecture that separates network handling, query processing, clustering logic, and storage.

API Layer

Axum & Tokio

Cluster Layer

Sharding & Raft

Logic Layer

SDBQL Engine

Storage Layer

RocksDB

Technology Stack

Core

  • Rust: Memory safety and performance without garbage collection.
  • Tokio: Asynchronous runtime for handling high concurrency.

Storage

  • RocksDB: Embedded key-value store optimized for fast storage.
  • Sled: Experimental support for pure-Rust storage engine.

Networking

  • Axum: Ergonomic and modular web framework.
  • Reqwest: HTTP client for cluster communication.

Tools

  • Clap: Command-line argument parser.
  • Serde: Serialization framework for JSON handling.

Project Structure

src/
api/ # API route handlers and definitions
sdbql/ # Query parser, optimizer, and execution engine
cluster/ # Node discovery and replication logic
sharding/ # Consistent hashing and shard management
storage/ # RocksDB wrapper and collection management
server/ # HTTP server startup and configuration
main.rs # Application entry point

Storage Layer

The storage layer is an abstraction over RocksDB. It handles document serialization, index management, and atomic operations.

Documents

Stored as JSON bytes. Key format: collection/key.

Indexes

Secondary indexes stored in separate column families for efficient lookups.

SDBQL Engine

The SDBQL (SoliDB Query Language) engine parses query strings into an Abstract Syntax Tree (AST), optimizes the execution plan, and executes it against the storage layer.

Query String
Lexer/Parser
AST
Optimizer
Execution Plan

Server & API

Built on Axum, the server handles HTTP requests, authentication middleware, and routing to appropriate handlers.

Cluster & Replication

Nodes form a mesh network. Data is replicated updates are propagated to peers. The system uses a leader-follower model for sharded collections.