Repository navigation
SutraDB v5.5.0 unifies the storage, indexing, SIMD distance, and observability pipeline under a native Rust core with prebuilt cross-platform Python wheels, a standalone --no-default-features gRPC/HTTP server binary, and verified durability up to 100K × 768d.
Quick Install
Python (sutradb-core==5.5.0)
Prebuilt wheels for Linux, macOS, and Windows (+ source sdist):
pip install sutradb-core==5.5.0Standalone Rust Server Binary (Zero Python Dependency)
cargo build --release --no-default-features --bin sutradb-server
./target/release/sutradb-server --host 0.0.0.0 --port 50051 --http-bridge-addr 127.0.0.1:8765 --data-dir ./sutra_dataContainer Images (321 MB Non-Root)
docker pull samcodesai/sutradb:5.5.0
# or via GHCR:
docker pull ghcr.io/sam-codesai/sutradb:5.5.0Key Architecture Upgrades Since v5.1.0
- Unified Rust Engine & Zero-Copy NumPy Ingest: Replaced split Python hot paths with
NativeCollectionbacked by PyO3insert_numpyzero-copy buffer ingestion. - Contiguous Arenas & Runtime SIMD Auto-Dispatch: Flat
VectorArena,SQ8Arena,BQArena, andPQArenaslabs paired with runtimestd::archkernels (AVX-512,AVX2 + FMA,ARM NEON, and scalar tails) safe across odd dimensions and non-finite inputs. - Cost-Based RoaringBitmap 1%-Filter Planner: Automatically bypasses HNSW traversal into a direct exact SIMD scan over matching
RoaringBitmapdocument IDs whenvalid_count <= 2048(or< 3%selectivity up to4096), eliminating post-filtering recall collapse and high-efgraph hops (412× speedup:77 ms -> 0.187 msat 100K × 768d). - Mean-Centered 2-Stage BQ & Parallel PQ with Mmap FP32 Eviction: 1-bit Binary Quantization (32× RAM reduction) and Product Quantization with mmap-backed FP32 arena eviction cleanly cut resident memory footprints while keeping Stage-2 reranking exact/SQ8-backed.
- O(N)-Free Sparse BM25 & WAND Pruning: Replaced full-corpus BM25 score vector allocations and
idf_cacheRwLockcontention with sparse postings accumulation + tombstone compaction, and added WAND / Block-Max WAND pruning toSparseIndex::search(). - Atomic
.sutra.idxInstant-Restart Persistence & Parallel HNSW: PersistsHNSWIndex(flatVec<Vec<u32>>layers +RoaringBitmaptombstones),IVFIndex,BQArena,PQArena+PQCodebook, andColbertCentroidsin a CRC32-verified.sutra.idxsidecar for instant cold restarts without rebuilding graphs, alongside Rayon-parallel HNSW batch construction (m=32, ef_construction=200). - Buffered
SWB1Binary WAL: Added 64 KBBufWritergroup commit (append_batch), compact binary frame encoding, partial-tail crash truncation, andDropbuffer flushing. - Production Auth/RBAC & Prometheus Observability: Constant-time API key authentication + collection-scoped RBAC (
admin|write|read) viaSUTRA_API_KEYandSUTRA_RBAC_CONFIGacross gRPC, HTTP bridge, and FastAPI/ui/statsproxy, plus Prometheus0.0.4histograms (sutradb_query_duration_seconds) and engine/WAL gauges atGET /metrics.
Verified Out-of-L3-Cache Scale Benchmark (100,000 × 768d)
Measured on a 2-vCPU Linux x86_64 host (AMD EPYC 7763, AVX2 / FMA, Python 3.14.2, Cosine, top_k=10, raw FP32 matrix = 293.0 MiB — reproducible via benches/scale_benchmark.py):
| Engine & Mode | Ingest / Build | P50 (ms) | P99 (ms) | QPS | Vector / Index RAM | Compression | Recall@10 |
|---|---|---|---|---|---|---|---|
| NumPy (Exact GEMV) | - | 35.019 | 56.064 | 27.4 | 293.0 MiB | 1× | 100.00% |
| SutraDB Flat (Rust AVX2 SIMD) | 29,228 docs/s | 14.236 | 21.737 | 68.1 | 293.0 MiB | 1× | 100.00% |
SutraDB HNSW Unfiltered (m=16) |
1,063 docs/s (build) | 0.417 | 0.645 | 2,291.2 | 326.2 MiB | 1× | 100.00% |
| SutraDB HNSW 1%-Filtered (Cost-Based Roaring SIMD) | 1,063 docs/s (build) | 0.187 | 0.297 | 4,913.9 | 326.2 MiB | 1× | 100.00% |
| SutraDB SQ8 (Mmap-Evicted 4×) | 18,966 docs/s | 6.516 | 10.836 | 141.5 | 73.2 MiB | 4.0× | 97.90% |
| SutraDB 1-Bit BQ (Mmap-Evicted 32×) | 19,243 docs/s | 2.043 | 3.580 | 436.2 | 9.2 MiB | 32.0× | 92.10% |
- Cold Restart (
.sutra+.sutra.idxsidecar): Save in1.99 s(308.3 MiB.sutra+14.9 MiB.sutra.idx); coldload()in3.07 s(3066.35 ms) withhas_hnsw=Trueand exact top-10 parity preserved. (At10K × 128dinbenches/BENCHMARK_REPORT.md:0.321 msHNSW P50 /99.20%Recall@10,634.54 mscold restart.)
Verification & Peak Chaos Scoreboard (332/332 Tests + 5/5 Torture Scenarios)
Reproducible via benches/peak_stress_test.py against target/release/sutradb-server and sutradb-core==5.5.0:
| Scenario | Result | Exact Measured Numbers |
|---|---|---|
1. 32-Client Concurrent Storm (20s, RBAC + Prometheus + live compact()/save()) |
PASS | 3,055 ops (152.75 ops/s), P50 = 70.80 ms, P99 = 1521.00 ms, 0 panics / 0 HTTP 500s; Prometheus parity (2,389 queries, 3,224 ingested docs) |
2. Real OS SIGKILL (kill -9) Torture (3 consecutive cycles, WAL enabled) |
PASS | 744 / 744 HTTP-200 acknowledged surviving docs recovered (100% survival across 75 batches + 15 deletes, 0 ghost deletes) |
3. 50% Delete/Upsert Churn + Compact + Cold Load (20,000 × 256d -> 10,000 -> 15,000) |
PASS | 10,000 tombstones compacted, 0 ghost docs across HNSW / 1%-filter / BM25 / SQ8 / BQ, post-compaction HNSW Recall@10 = 98.20% |
| 4. 10,000-Query PyO3 -> Rust Memory-Leak Soak (6 mixed query modes) | PASS | RSS@1K = 291.32 MiB, RSS@10K = 291.32 MiB (+0.00 MiB delta); Early vs Late P50: 0.228 -> 0.229 ms, P99: 0.553 -> 0.554 ms |
| 5. Live Adversarial Fuzz & Security Gauntlet | PASS | 30 / 30 probes returned clean 400/401/403/404/200 (NaN/1e50, wrong dim, top_k=0/1M, ../ + NUL traversal, ReDoS regex, cross-tenant /ui/stats, bit-flipped .sutra/.sutra.idx) |
CI Test Suites (clippy -D warnings + cargo test --release + pytest) |
PASS | 332 / 332 passing (98 Rust + 234 Python) |
Scope & Roadmap Note
v5.5.0 is an embedded/single-node vector + lexical + ColBERT engine verified up to 100K × 768d (293 MiB FP32). Multi-segment LSM compaction and 10M+ multi-node distributed tiering are planned for v6.0.