BudgetVec is now in public beta — deploy billion-scale vector search on Cloudflare for $0.015/GB. Get started →

Architecture

BudgetVec is built as a Rust → WASM application running on Cloudflare Workers, with R2 for durable storage and KV for caching and control plane data.

System Diagram

┌──────────────┐

│ Client │

│ (SDK / HTTP) │

└──────┬───────┘

│ HTTPS

┌──────────────────────────┐

│ Cloudflare Worker │

│ (Rust → WASM, 691 KB) │

│ │

│ ┌─────────────────────┐ │

│ │ Router / Auth │ │

│ │ Tenant isolation │ │

│ └─────────┬───────────┘ │

│ │ │

│ ┌─────────▼───────────┐ │

│ │ Ingestion Pipeline │ │

│ │ Validate → Encode │ │

│ │ → WAL batch │ │

│ └─────────┬───────────┘ │

│ │ │

│ ┌─────────▼───────────┐ │

│ │ Query Engine │ │

│ │ ANN (SPTAG/PQ ADC) │ │

│ │ BM25 (Thai + EN) │ │

│ └─────────┬───────────┘ │

│ │ │

│ ┌─────────▼───────────┐ │

│ │ Pufferfish Cache │ │

│ │ L1: Worker memory │ │

│ │ L2: KV │ │

│ │ L3: R2 │ │

│ └─────────────────────┘ │

└──────────────────────────┘

┌──────────────┐ ┌──────────────┐

│ R2 Storage │ │ KV Store │

│ $0.015/GB │ │ Control + │

│ Vectors/WAL │ │ Cache │

└──────────────┘ └──────────────┘

Crate Structure

BudgetVec is organized as a Rust workspace with 6 crates:

CratePurpose
sptag-sysC++ FFI bindings for SPTAG indexing
sptagSafe Rust wrapper around SPTAG
coreCodecs (PQ, RaBitQ), storage, text processing, BM25
workerCloudflare Worker entry point, routes, platform code
build-cliOffline index builder CLI tool
tests/http-integrationHTTP integration test suite

Compression Pipeline

Vectors go through a two-stage compression:

1. RaBitQ — 1-bit quantization reduces each float32 dimension to 1 bit, giving 32× compression for distance approximation

2. Product Quantization (PQ) — Subdivides vectors into M subspaces, quantizes each to K centroids, enabling ADC (Asymmetric Distance Computation) for fast approximate search

Multi-Tenant Isolation

Each tenant has:

  • Unique API key (FNV-1a hashed for lookup in KV)
  • Isolated R2 prefix: {base_namespace}/{namespace}/...
  • Per-tenant KV cache entries
  • Configurable vector dimensions, plan limits, and default region

Regions

BudgetVec supports 6 deployment regions, each with dedicated R2 buckets and KV namespaces:

RegionLocation
WNAMUS West
ENAMUS East
WEURWestern Europe
EEUREastern Europe
APACAsia-Pacific
OCOceania