Architecture: The Indexed LakehouseΒΆ
BenoDB implements an indexed, compute-disaggregated lakehouse storage architecture that pairs authoritative open table storage with advisory, persistent secondary indexes and a unified retrieval layer.
Iceberg Table
β
βββββββββββββββ΄βββββββββββββββ
β β
Authoritative Storage Advisory Index Overlay
β β
Parquet Files Bitmap / Bloom / BM25 / HNSW / TQ
Core PhilosophyΒΆ
βYour Data is Standard. Your Index is Custom.β
BenoDB attaches persistent, reconstructible sidecar index files alongside standard Parquet files:
100% Format Compatibility: Standard data engines (Spark, Trino, DuckDB, Pandas) read the underlying Parquet and Iceberg tables directly at native speed.
O(log N) Accelerated Retrieval: BenoDB-aware query engines and REST search gateways leverage inverted bitmap and vector indexes for low-latency queries directly on object storage.
The Overlay Invariant: Indexes are derived state. If an index file is absent, corrupted, or stale, queries safely degrade to Parquet scanning without failing or returning incorrect results. See ADR-001: Tightened Overlay Index Artifact Contract & Compound Puffin Bundles.
Storage Layout: Hybrid SegmentsΒΆ
Data is stored in immutable Segments pairing open columnar storage with advisory index sidecars:
Authoritative Raw Data:
data/segment_id.parquet: Standard Apache Iceberg columnar data files written with ZSTD compression and dictionary encoding. 100% readable by external engines (DuckDB, Spark, Trino, Polars).
Advisory Secondary Indexes (Apache Iceberg Puffin Compound Bundles):
metadata/segment_id.puffin: As specified in ADR-001, production deployments consolidate secondary index artifacts into standard Apache Iceberg Puffin (.puffin) compound bundles. A single.puffinfile encapsulates Roaring Bitmap inverted indexes, BM25 term frequencies, and Voronoi-clustered HNSW/TurboQuant vector graphs queried via HTTP byte-range offsets, preventing cloud object count explosion.(Uncompacted / Local Debug Mode): Prior to Voronoi cluster compaction (
rebuild_cluster_index), transient per-column sidecars (.inv.parquet,.bm25.parquet,.centroids.parquet,.hnsw.graph) may be emitted beforecompact()orvacuum()merges them into compound Puffin bundles.
Iceberg Table Metadata:
_manifest/v{N}.avro: Standard Iceberg V2/V3 snapshot manifests and manifest lists._metadata/v{N}.metadata.json: Iceberg table schema, sort orders, partition specs, and snapshot lineage.
Ingestion Pipeline: Non-Blocking Indexing & Async WALΒΆ
BenoDB achieves high ingestion throughput while maintaining real-time queryability:
Memtable & Async WAL: Incoming records write to an in-memory batch buffer with adaptive or immediate WAL fsync durability.
Parquet Flushes: Records flush to compressed Parquet files for immediate durability.
Background Indexing: High-dimensional vector graphs (HNSW-IVF) and full-text indexes build asynchronously across a Rayon thread pool without blocking writes.
Atomic Manifest Snapshot: Once background index construction completes, the manifest is atomically swapped via Optimistic Concurrency Control (OCC) or distributed CAS locks (
FileBasedLock).
The Read Path & Hot Row CacheΒΆ
BenoDB combines scalar pre-filtering, vector search, and in-memory caching for ultra-low latencies:
Scalar Pruning: Query planner evaluates inverted index sidecars, producing a candidate row bitmap.
Vector / Keyword Scoring:
Vector Search: Traverses HNSW graph sidecars, evaluating candidates with dynamic SIMD metrics.
Full-Text Search: Scores terms using BM25 Okapi sidecars.
Hybrid RRF: Combines ranks from vector and keyword search using Reciprocal Rank Fusion ($1 / (k + \text{rank} + 1)$).
Hot Row Cache (
BLOCK_CACHE):Decoded Parquet
RecordBatchchunks are held in an in-memory LRU block cache.Scattered kNN candidate row fetches resolve directly from memory in sub-millisecond time, completely bypassing disk I/O and eliminating tail latency spikes.
Table-Level Cluster Indexing & Sequential 512 MiB Puffin ShardingΒΆ
For multi-million and 100M+ vector tables, per-segment vector sidecars create query fan-out overhead across hundreds of small HNSW graphs. BenoDB provides Table-Level Cluster Indexing (ClusterIndex) via table.rebuild_cluster_index():
Table-Level Cluster Index (v42)
(Locality-Ordered Centroids 0..K-1)
β
ββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββ
β β β
Shard 0000 (β€512 MiB) Shard 0001 (β€512 MiB) Shard 0002 (β€512 MiB)
Clusters [0 .. K0] Clusters [K0+1 .. K1] Clusters [K1+1 .. K2]
1. cluster-codes (BSCD v1) 1. cluster-codes (BSCD v1) 1. cluster-codes (BSCD v1)
2. (seg_id, row_id) Parquet 2. (seg_id, row_id) Parquet 2. (seg_id, row_id) Parquet
3. HNSW Graphs (IPC) 3. HNSW Graphs (IPC) 3. HNSW Graphs (IPC)
Architectural Guarantees:ΒΆ
Decoupled Overlay Invariant: Cluster nodes carry
(segment_idx, row_id)tuples stored in Arrow Parquet metadata tables (org.apache.iceberg.vector.cluster-node-meta). The underlying Parquet data files are read once and never rewritten or compacted, preserving standard Apache Iceberg read compatibility.Codes-First Split Blob Layout & Codes-Only Query Path: Each shard stages and seals blobs in contiguous codes-first order (
org.apache.iceberg.vector.cluster-codesβcluster-node-metaβhnsw-graph). At query time,ClusterIndexscans the compact 16-byte-aligned flat codes blob directly (skipping HNSW graph deserialization and I/O entirely) and hydratesnode_metaonly for the small set of winning clusters that contribute to top-$k$. Legacy shards written withoutcluster-codesblobs fall back transparently to HNSW graph traversal; setBDB_CLUSTER_SEARCH_MODE=graphto force graph traversal for A/B benchmarking.Locality-Ordered Centroids & Sequential 512 MiB Rolling Shards: Global centroids are ordered before assignment by deterministic recursive furthest-pair projection bisection with Hilbert-style seam orientation, then packed into rolling $\le 512\text{ MiB}$ Puffin shards (
cluster_{col}_{version}_shard_{i}.puffin) with strictly monotonic disjoint cluster ranges (min_cluster..=max_cluster). Co-probed centroids land in adjacent offsets within the same shard, enabling single-GET S3 coalescing and respecting cloud single-PUT limits.S3 Pipelining, Singleflight Coalescing & Unified Cache Budget: On local storage, shards are memory-mapped zero-copy (
memmap2) with chunkedposix_fadvise(WILLNEED)pipelining over codes spans only. On remote object storage (s3://,gs://,az://), queries resolve footers and fetch touched shards concurrently (get_rangecoalesced across adjacent codes blobs), pipeline batches on Tokio while scanning on CPU, and deduplicate concurrent misses via per-keySingleFlightgates under a single unified byte-weighedmokacache (BDB_CLUSTER_CACHE_KIBorBDB_CACHE_GB / 4).Cross-Architecture SIMD Parity & Multi-Threaded Rayon Compaction: Centroid assignment (Pass 2) and intra-bucket cluster construction (Pass 3) run across CPU cores via Rayon with single-pass quantization and disk-staged shard sealing to bound build memory inside 16 GiB containers. Batch code scanning dispatches to hoisted AVX2+FMA kernels on
x86_64(Intel/AMD) and native ARM64 NEON kernels onaarch64(Apple Silicon M-series / AWS Graviton / Azure Cobalt) across TQ8, TQ4 (16-nibble unpacking), SQ8, Cosine/IP, L1, and F32, plus 4-way unrolled L1-LUT accumulation for PQ.
Multi-Protocol Search Gateway (bdb-search)ΒΆ
BenoDB exposes its columnar storage and index overlays via standard REST protocols:
OpenSearch / Elasticsearch 7.10 API (Port 9200): Drop-in compatibility for
_search,_bulk,_mapping, and_cat/indices.Qdrant Vector API (Port 6333): Qdrant v1.x REST emulation β collections, point upsert/retrieve, payload & vector edits, vector search, aliases, and the universal query API. See QDRANT_COMPATIBILITY.md.
Arrow Flight SQL (Port 50051): Low-latency zero-copy gRPC queries for analytical tools.