Orion Rust Vector Search: Moving 1.7 TB Off Postgres and pgvector

Circleback migrated 1.7 TB of unindexed meeting embeddings off PostgreSQL and pgvector into Orion, a custom Rust search engine backed by S3/GCS blob storage. Serving 3.5 million monthly searches (nearly 90% from AI agents via MCP, API, and CLI), Orion cuts tail latency from 20-40 seconds to tens of milliseconds and reduces search infrastructure costs by 90%.
Orion Rust Vector Search: Moving 1.7 TB Off Postgres and pgvector: Circleback migrated 1.7 TB of unindexed meeting embeddings off PostgreSQL and pgvector into Orion, a custom Rust search engine backed by S3/GCS blob storage. Serving 3.5 million monthly searches (nearly 90% from AI agents via MCP, API, and CLI), Orion cuts tail latency from 20-40 seconds to tens of milliseconds and reduces search infrastructure costs by 90%. Designed as a zero-dependency, open-source TypeScript architecture under the MIT License with native Model Context Protocol (MCP) support and deterministic phase state machines.
- 10x Infrastructure Cost Reduction: Moves 1.7 TB of cold and warm vector segments to S3/GCS object storage instead of keeping RAM-heavy Postgres or Elasticsearch nodes hot 24/7.
- 40s to <100ms Latency Drop: Per-meeting shard isolation eliminates cross-tenant full-table scans that previously evicted OLTP working sets from Postgres shared buffers.
- In-Process Embedding Generation: Unlike vector-only stores such as Turbopuffer, Orion ingests raw text and computes embeddings locally, turning off external embedding API bills.
- CAS Optimistic Compaction + jemalloc: Immutable object writes paired with Compare-And-Swap manifest updates and jemalloc prevent memory fragmentation under 3.5M queries/month.
import { createAgent } from '@smoke-monkey/harness';// Connect Smoke Monkey Harness to a sharded Rust/blob vector MCP serverconst agent = createAgent({agentId: 'orion-meeting-rag-agent',provider: 'openai-compatible',baseUrl: 'http://127.0.0.1:8080/v1',model: 'Qwen/Qwen3.8-27B',workspacePath: process.cwd(),mcpServers: {orionSearch: {command: 'npx',args: ['-y', '@smoke-monkey/mcp-orion-search', '--bucket', 's3://meeting-index-prod'],env: {ORION_ALLOCATOR: 'jemalloc',ORION_SHARD_CACHE_DIR: '/var/cache/orion/shards',},},},permissions: {read_file: 'allow',write_file: 'ask',run_command: 'ask',},});async function main() {const result = await agent.run('Query meeting shards for Q4 pricing decisions across authorized tenant IDs and summarize action items.');console.log('RAG Summary:', result.summary);}main().catch(console.error);
Watch: Related Video Guides
How I Added Vector Search to my Course (Postgres + PGVector )
Do You Really Need a Vector Database? pgvector vs Dedicated
What Is Orion and Why Did 1.7 TB of pgvector Fail?
Orion is Circleback's Rust search engine backed by cloud blob storage (S3/GCS) that replaced a 1.7 TB PostgreSQL pgvector table serving 3.5 million monthly searches, 90% triggered by AI agents over MCP, API, and CLI. By hashing each meeting into deterministic shards and computing embeddings in-process, Orion cut p99 tail latency from 20-40 seconds to under 100 ms at one-tenth the cost.
In the legacy Postgres setup, unindexed pgvector scans swept every accessible transcript chunk on disk, evicting transactional application rows from memory and forcing three vertical database upgrades. Additionally, asymmetric full-text stemming indexed "pricing" as "price" without matching query stemming, silently dropping CJK characters and exact morphological matches.
| Architecture Metric | Legacy Postgres + pgvector | Elasticsearch / Dedicated Cluster | Orion (Rust + Blob Storage) |
|---|---|---|---|
| Stored Corpus Footprint | 1.7 TB inside primary OLTP DB | Hot SSD disks across always-on nodes | Immutable segments in S3 / GCS |
| Large-Account Search Latency | 700 ms scan; 20-40 s worst case | Sub-second (with high idle RAM cost) | <100 ms chunk lookup; tens of ms core |
| External Embedding API Cost | Highest line item in search bill | Requires external embedder | $0 external API (in-process embedder) |
| Permission & Multi-Tenancy | Row-level scan across shared table | Index/filter routing | Per-meeting shard isolation via app IDs |
| Memory Allocator Behavior | Postgres buffer cache thrashing | JVM GC pauses under large heaps | Rust + jemalloc (eliminates leak/hold) |
How Blob-Backed Sharding, CAS Writes, and jemalloc Work
Orion adopts a Turbopuffer-inspired object-storage model while eliminating external embedding pipelines and keeping all customer data inside a single VPC. Because S3 and GCS objects are immutable once written, Orion separates write durability from background compaction:
- Compare-And-Swap (CAS) Manifest Commits: When ingesting a transcript, Orion writes an immutable segment object and performs a conditional CAS update on a lightweight manifest file listing active segments. Concurrent writers cannot clobber each other, and a background compactor merges small files into larger search-optimized segments.
- Application-Computed Shard Filtering: Orion itself stores zero ACL tables. Every MCP or API query supplies the caller's authorized meeting IDs, and Orion hashes those IDs directly to the subset of shards containing them, skipping cold meeting history completely.
- Fixing Allocator & Serialization Bottlenecks: Profiling preview traffic against production uncovered two non-obvious traps: the default Linux system allocator retained freed heap pages after bursty indexing (resolved by switching to
jemalloc), and Node/Prisma ORM layers repeatedly copied large binary transcript buffers before reaching Rust, triggering multi-hundred-millisecond GC pauses.
Do Not Quantize Embeddings Blindly in Production
In Circleback A/B testing across 30+ tuning experiments, quantized embedding models improved raw vector throughput but degraded retrieval recall on edge queries, so production Orion retains full-precision embeddings paired with fast shard pruning.
Reproducible Rust + jemalloc Vector Service Configuration
To replicate Orion's allocator tuning and object-store sharded layout in a self-hosted Rust RAG service for Smoke Monkey MCP agents, enable tikv-jemallocator and shadow-test against production queries before dropping your pgvector table:
# 1. Initialize a Rust search worker with jemalloc and object_store crates
cargo new orion-worker && cd orion-worker
cargo add tikv-jemallocator object_store tokio serde_json
# 2. Configure jemalloc decay timers to aggressively return freed pages to the OS
export MALLOC_CONF="dirty_decay_ms:1000,muzzy_decay_ms:1000,narenas:4"
# 3. Run shadow traffic parity checks comparing pgvector recall vs sharded blob index
cargo run --release -- \
--manifest-uri s3://prod-rag-index/manifest.json \
--cache-dir /mnt/nvme/orion-cache \
--shadow-compare-pg "$DATABASE_URL"Frequently Asked Questions
Q:Why did Circleback build Orion instead of using Turbopuffer or Elasticsearch?
Turbopuffer stores vectors but requires an external embedding pipeline, which was Circleback’s single highest search expense, whereas Elasticsearch requires keeping cold meeting indices warm on continuously running SSD nodes. Orion generates embeddings in-process and stores cold segments in cheap S3/GCS blob storage.
Q:Why did switching to jemalloc fix Orion’s memory retention in Rust?
Under spiky transcript ingestion and compaction workloads, the default glibc/system allocator held onto freed heap arenas instead of returning pages to the kernel. Switching to jemalloc stabilized resident set size (RSS) on multi-tenant machines shared with other microservices.
Q:How does Orion enforce multi-tenant permissions without an auth database?
The application tier resolves which meeting IDs a user or MCP agent is authorized to access and passes that ID list with each query. Orion hashes those IDs to open only the matching shards, guaranteeing zero cross-tenant scans.
Q:How much faster and cheaper is Orion compared to pgvector?
Worst-case large-account searches dropped from 20-40 seconds (with 700 ms unindexed chunk scans) to under 100 ms chunk lookups and tens of milliseconds in Orion core, while total search infrastructure cost dropped by roughly 90% (one-tenth of prior spend).
Related Alternatives & Comparisons
Related Architecture Guides
View all guidesBest Open Source Coding Agents in 2026: Free, Local & Fully Hackable Harnesses
MCP Server Security Best Practices: Hardening Model Context Protocol Agents in 2026
Open Source Coding Agent Harness: Build a Forkable, Local AI Engineering Runtime
Build with Smoke Monkey Harness
Zero dependencies. 24 built-in tools. Human-in-the-loop safety. 100% open source under the MIT License.