The Unified Hybrid-Search
Database Engine
Eliminating the "Sync Gap" between primary storage and search indices through an atomic, embedded, leaderless architecture.
article Executive Summary
Modern applications typically require two data layers: a durable Key-Value store (like Redis or DynamoDB) for transactional speed, and a Search Engine (like Elasticsearch) for complex queries. Keeping these systems synchronized is a notorious source of engineering complexity, data inconsistency, and operational cost.
CameoDB solves this by fusing an ACID-compliant Key-Value store (Redb) with a high-performance Full-Text Search engine (Tantivy) into a single, leaderless binary. By leveraging the Rust 2024 ecosystem and an Actor-based architecture, CameoDB delivers microsecond latency, zero-copy serialization, and operational simplicity for edge and cloud-native workloads.
The Sync Gap Problem
In traditional architectures, writing data involves a "dual-write" problem. You write to the database, then asynchronously update the search index. This gap creates a state where search results are stale or inconsistent with the primary store.
warning Traditional Stack
- close Two entirely separate clusters to manage and scale independently.
- close Eventual consistency lag between database writes and search availability.
- close Complex failure recovery and distributed transaction management.
check_circle CameoDB Solution
- check Single statically compiled binary with embedded storage.
- check Atomic writes guaranteeing KV and Search Index remain perfectly synced.
- check Shared-nothing architecture for simple horizontal scaling.
The Hybrid Storage Engine
At the core of CameoDB is a specialized storage engine that treats Redb (embedded KV) and Tantivy (Search) as a single atomic unit. This ensures that if a document is durably stored, it is also instantly indexed.
The Atomic Write Pipeline
Sequence & WAL
A monotonic sequence ID is generated. The operation is serialized and written to the Write-Ahead Log (WAL) inside Redb for durability.
KV Insert
The document body is inserted into the Redb Data Table. This provides extremely fast O(log N) point retrieval by ID.
Tantivy Indexing
The document fields are parsed and added to the in-memory Tantivy IndexWriter for full-text search availability.
Dual Commit
The Redb transaction commits (fsync). Tantivy performs a smart commit based on memory budget. Data is fully recoverable.
Leaderless Distributed Mesh
CameoDB adopts a Self-Sovereign Identity model. There are no master nodes to become bottlenecks. Every node is capable of routing, writing, and reading.
Topology & Consistent Hashing
To ensure uniform distribution without hotspots, CameoDB utilizes a Consistent Hash Ring with 256 Virtual Nodes (VNodes) per physical node.
Smart Routing Strategies
The internal `RouterActor` dynamically chooses between Unicast and Scatter-Gather based on the request context, ensuring optimal cluster performance.
Unicast (Targeted)
O(1) NodeUsed when a `routing_key` or `id` is provided. Sent directly to the owner via libp2p.
> Hash("123") -> Node B
> Node A -> Node B (Direct)
Scatter-Gather
O(N) NodesUsed for broad search queries. The router fans out the request, aggregates, and sorts.
> Node A -> [A, B, C]
> Aggregate & Sort Hits
Engineered for Speed
CameoDB is built on Rust 2024, leveraging the Actor Model (Kameo) to ensure fault isolation. A critical architectural choice is the strict separation of Async and Sync workloads.
The `spawn_blocking` Firewall
Storage I/O (Redb/Tantivy) is strictly isolated in blocking thread pools. The network/actor runtime (Tokio/Axum) remains purely async. This prevents heavy disk writes from stalling HTTP request handling, keeping P99 latency ultra-low even during massive bulk ingestions.
Why Invest in CameoDB?
Replaces two distinct infrastructure components (DB + Search) with one self-contained, easy-to-manage binary.
Written in Rust with safety built-in. No JVM. No Garbage Collection pauses. Significantly smaller memory footprint.
High scalability with a tunable footprint. Runs seamlessly on edge hardware, yet scales effortlessly to massive clouds.