High-performance .NET bindings for DBX embedded database


Keywords
database, embedded, high-performance, key-value, embedded-database, gpu, htap, key-value-store, mvcc, rust, sql
License
MIT
Install
Install-Package DBX.Dotnet -Version 0.2.2

Documentation

DBX โ€” Next-Generation HTAP Embedded Database

{: .fs-9 }

Version License Rust Documentation

๐Ÿ’– Support This Project

If you find DBX useful, please consider supporting its development!

ko-fi

Your support helps with:

  • ๐Ÿš€ New features and performance optimizations
  • ๐Ÿ› Bug fixes and stability improvements
  • ๐Ÿ“š Documentation and tutorials
  • ๐Ÿ’ป Test infrastructure and CI/CD maintenance

DBX is a high-performance, embedded database designed for modern HTAP (Hybrid Transactional/Analytical Processing) workloads. Built with a unique 5-Tier Hybrid Storage architecture, it bridges the gap between ultra-fast in-memory transactions and massive-scale columnar analytics. {: .fs-6 .fw-300 }


โšก The DBX Edge: Why Choose Us?

๐Ÿš„ 1. Infinite Scalability (5-Tier Architecture)

Unlike traditional databases that force a choice between speed and capacity, DBX flows data through 5 specialized tiers:

  • Tier 1 (Delta): Ultra-fast BTreeMap for sub-millisecond writes.
  • Tier 2 (Cache): Apache Arrow-based columnar cache for instant OLAP.
  • Tier 3 (WOS): SSD-optimized MVCC storage for snapshot isolation.
  • Tier 4 (Index): High-speed Bloom filters for near-zero latency probes.
  • Tier 5 (ROS): Compact Parquet storage for petabyte-scale archiving.

๐ŸŽ๏ธ 2. Blazing Fast Performance

Benchmark results (10,000 records) show DBX outperforming industry standards with the new Fast-Path optimization (v0.2.0):

  • Local Scan: 51ยตs (microseconds) โ€” Ultra-low latency via local bypass ๐Ÿ”ฅ
  • Memory INSERT: 1.16x faster than SQLite (25ms vs 29ms) โœ…
  • Analytics (OLAP): Up to 29x faster than traditional B-Tree engines.

๐Ÿง  3. GPU-Native Analytics

DBX is the first embedded database to offer first-class CUDA acceleration.

  • 4.5x faster filtering and aggregation on large datasets.
  • Seamlessly offload heavy JOINs and GROUP BY operations to the GPU.

โšก Zero-Lock Concurrency (MVCC) + Distributed Locks (DLM)

Readers never block writers, and writers never block readers. Equipped with a Network-Aware Distributed Lock Manager (DLM) that uses Fencing Tokens and Adaptive Leases via GridDatabaseAsync, while strictly preserving single-node HTAP latency.

  • Built-in absolute Atomic CAS operations (insert_if_not_exists, compare_and_swap).
  • Super-fast 1024-Striped Row-level Latch Lock Manager, removing heavy table mutexes from the main data store. (Providing blazing-fast concurrent operations across 5 tiers without table-level bottlenecks). (Disclaimer: Secondary Index updates currently utilize standard RwLock for tree integrity, resulting in brief column-level locks during write-heavy index operations.)

๐ŸŒ 5. Distributed Grid Architecture (Grid Engine)

A Data Grid is a distributed computing architecture where multiple machines connected over a network act as one unified database. DBX has this grid engine built-in, allowing you to start as a single-node embedded DB and โ€” without any code changes โ€” scale horizontally across networked nodes.

๐Ÿ’ก Why Grid? Traditional embedded databases (SQLite, Sled, etc.) are confined to a single process. DBX is the only embedded database capable of real-time data replication and distribution across nodes over the network.

  • Network Replication (QUIC Transport): Ultra-low latency data replication between nodes via TLS 1.3 QUIC protocol. Zero Head-of-Line Blocking ensures stability even in large clusters.
  • Quorum-based High Availability: Raft-like leader election with majority ACK approval ensures data consistency and service continuity even when some nodes go down.
  • Multi-Master Failover: Automatic leader election on failure with Vector Clock-based conflict resolution to maintain data integrity.
  • Auto-Sharding (Cross-Node): Data is automatically distributed across nodes. Adding a node triggers automatic rebalancing, scaling capacity and throughput linearly.
  • Distributed Transactions (2PC): Transactions spanning multiple nodes are guaranteed atomic via Two-Phase Commit.

๐Ÿ“ฆ Modern Capabilities

๐Ÿ’Ž Materialized Views

Define complex analytical queries and let DBX handle the heavy lifting.

  • Auto-Refresh: Background threads keep your results fresh every 60 seconds.
  • Transparent Caching: SQL queries hit the cache automatically for instant responses.

๐ŸŒŠ Real-time Streaming (CDC)

Built-in StreamIngester for high-throughput data pipelines.

  • MPSC Pipeline: Concurrently ingest from thousands of producers.
  • Full DML Support: Real-time INSERT, UPDATE, and DELETE processing.

๐Ÿฆ€ Rust Ecosystem Compatibility

DBX is designed to integrate seamlessly with the modern Rust data ecosystem.

  • Native Serde Support: Store and retrieve custom Rust structs directly without manual byte conversions via the DatabaseSerde trait.
  • Async First Driver: A non-blocking wrapper DatabaseAsync seamlessly offloads heavy I/O to tokio::task::spawn_blocking, making it perfect for heavily concurrent async web servers.

๐Ÿ—๏ธ Architecture Visualization

graph TD
    A[Application] -->|Write| B[Tier 1: Delta Store]
    B -->|Flush| C[Tier 2: Columnar Cache]
    C -->|Persist| D[Tier 3: WOS - SSD]
    D -->|Compact| E[Tier 4: Index]
    E -->|Archive| F[Tier 5: ROS - Parquet]
    
    G[GPU Acceleration] -.->|Speed Up| C
    G -.->|Speed Up| F
    
    style B fill:#f9f,stroke:#333,stroke-width:2px
    style C fill:#bbf,stroke:#333,stroke-width:2px
    style F fill:#bfb,stroke:#333,stroke-width:2px
Loading

๐Ÿš€ Quick Start (Rust)

use dbx_core::Database;

fn main() -> dbx_core::DbxResult<()> {
    // Open a database in memory or on disk
    let db = Database::open_in_memory()?;

    // Lightning-fast CRUD
    db.insert("users", b"user:123", b"{\"name\": \"Alice\", \"age\": 30}")?;
    let val = db.get("users", b"user:123")?;

    // Powerful HTAP SQL
    let results = db.execute_sql("SELECT name, AVG(age) FROM users GROUP BY name")?;

    Ok(())
}

๐Ÿค Support & Contributing

DBX is an open-source project powered by the community.

  • โญ๏ธ Star us on GitHub to show your support!
  • ๐Ÿ› Report issues or request features via GitHub Issues.
  • ๐Ÿ› ๏ธ Contribute: Check our Contributing Guide for build optimizations (LLD, mold, etc.).

Made with โค๏ธ in Rust for the Future of Data.