Scaling Vector Search Infrastructure for AI-Powered Workspace Search

notion · Tech · 2026 · source Agentic: no · promotional bias: med · source-backed · extracted with prompt 0.5.4 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: Tech

Notion needed vector search infrastructure for AI Q&A to onboard millions of workspaces while controlling rapidly growing vector database and embedding costs.

Constraints:

Architecture

Notion's AI Q&A stack uses vector search as the retrieval layer for workspace and connected-tool content. The architecture evolved from dedicated pod-based vector databases with workspace-sharded indexes into a layered indexing and serving system: offline Spark batch jobs and online Kafka consumers generated embeddings and kept workspaces fresh, generation IDs routed reads/writes across new index sets during hypergrowth, serverless and then turbopuffer separated storage economics from compute, Page State hashes avoided redundant re-embedding, and Ray/Anyscale moved embedding generation plus query-time embedding serving onto a self-hosted ML compute layer.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  connected-tool-content["connected-tool-content"] --> offline-indexing-pipeline["offline-indexing-pipeline"]
  connected-tool-content --> online-indexing-consumers["online-indexing-consumers"]
  offline-indexing-pipeline --> embedding-models["embedding-models"]
  online-indexing-consumers --> page-state-cache["page-state-cache"]
  page-state-cache --> offline-indexing-pipeline
  page-state-cache --> online-indexing-consumers
  embedding-models --> vector-search-backend["vector-search-backend"]
  offline-indexing-pipeline --> vector-search-backend
  online-indexing-consumers --> vector-search-backend
  generation-router["generation-router"] --> vector-search-backend
  turbopuffer["turbopuffer"] --> vector-search-backend
  ray-indexing-platform["ray-indexing-platform"] --> embedding-models
  notion-ai-qa["notion-ai-qa"] --> query-embedding-service["query-embedding-service"]
  query-embedding-service --> embedding-models
  query-embedding-service --> vector-search-backend
  vector-search-backend --> notion-ai-qa
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
notion-ai-qa User-facing Q&A and agent layer that asks natural-language questions over workspace and connected-tool content. query-embedding-service, vector-search-backend
offline-indexing-pipeline Spark/Ray batch path that chunks existing documents, generates embeddings, and bulk-loads vectors. embedding-models, vector-search-backend, page-state-cache
online-indexing-consumers Kafka-driven real-time path that processes individual page edits for live workspaces. page-state-cache, embedding-models, vector-search-backend
generation-router Routes reads and writes to the correct index set while new workspace generations are provisioned. notion-ai-qa, vector-search-backend
vector-search-backend Vector database layer that evolved from pod clusters to serverless and turbopuffer namespaces. generation-router, offline-indexing-pipeline, online-indexing-consumers, notion-ai-qa
turbopuffer Object-storage-backed search engine used for the multi-billion-object workload and simplified namespace indexing. vector-search-backend, offline-indexing-pipeline
page-state-cache DynamoDB cache of span text and metadata hashes used to avoid unnecessary re-embedding or reloads. offline-indexing-pipeline, online-indexing-consumers
embedding-models Embedding models used for document spans and query-time semantic search. offline-indexing-pipeline, online-indexing-consumers, query-embedding-service, vector-search-backend
ray-indexing-platform Ray on Anyscale compute layer for near-real-time embedding generation and preprocessing/inference pipelining. offline-indexing-pipeline, online-indexing-consumers, embedding-models
query-embedding-service Ray Serve deployment for query-time embeddings with batching, replication, and autoscaling. notion-ai-qa, embedding-models, vector-search-backend
connected-tool-content Workspace and connector content from Notion, Slack, Google Drive, and other sources searched by Q&A. offline-indexing-pipeline, online-indexing-consumers

Data flow

Notion chunks workspace documents, generates semantic embeddings, and writes vectors plus metadata into a vector search backend. Offline Spark jobs bulk-index existing content while Kafka consumers process live page edits with sub-minute freshness. During growth, workspace generation IDs route reads and writes to the right index set. Later, Page State compares text and metadata hashes from DynamoDB to decide whether to re-embed spans, patch metadata, or skip work. At query time, Notion AI embeds the user query, searches the vector database for semantically relevant workspace/connector content, and uses those retrieved results as context for Q&A and agents.

6 supporting quotes
“This is essential for Notion AI, which answers natural-language questions by searching content from across a user’s workspace and connected tools like Slack and Google Drive.”article, stated
“Offline path: Batch jobs running on Apache Spark that chunk existing documents, generate embeddings via API, and bulk-load vectors into our vector database”article, stated
“Online path: Real-time updates via Kafka consumers that process individual page edits as they happen”article, stated
“Each set got a "generation" ID that determined where reads and writes would go.”article, stated
“we chunk the page, get the previous state of the page from DynamoDB, and compare all the text hashes. We detect exactly which spans changed”article, stated
“When users or agents search Notion, we need to embed queries on the fly. We can’t search our vector DB until that computation finishes”article, stated

Why this architecture

Notion chose a retrieval-first vector architecture because AI Q&A depends on semantic search over each workspace and connected tools. The system kept separate offline and online indexing paths so it could bulk-onboard large workspaces while maintaining live freshness. Generation routing let the team keep onboarding while avoiding repeated reshards. Serverless/turbopuffer reduced fixed infrastructure cost, Page State cut redundant write volume, and Ray gave Notion more control over embedding model evolution, reliability, and query-time latency.

5 supporting quotes
“Vector search fixes this by turning text into semantic embeddings: points in a high-dimensional space where similar ideas cluster together.”article, stated
“This dual-path architecture let us onboard large workspaces efficiently while keeping live workspaces up-to-date with sub-minute latency.”article, stated
“This kept us moving without stopping to do any re-shard operations.”article, implied
“turbopuffer treats each namespace as an independent index without worrying about sharding or generation routing”article, stated
“Ray lets us run open-source embedding models directly, without being gated by external providers. As new models are released, we can experiment and adopt them immediately”article, implied

Models used: embedding model · open-source embedding models

Scale

Alternatives considered (roads not taken)

Incrementally re-shard existing vector indexes every two weeks

Rejected because: Repeatedly cloning, deleting, and rebalancing indexes would slow onboarding during hypergrowth.

“Re-shard incrementally: Clone the data into another index, delete half, and repeat every two weeks as we onboarded new customers”article, stated
“Instead, when a set of indexes approached capacity, we'd provision a new set and direct all new workspace onboarding there.”article, stated

Provision vector capacity for the final expected volume

Rejected because: The provider charged for uptime, making large over-provisioned pod capacity too expensive.

“Re-shard to final expected volume: Our chosen vector database provider charged for database uptime, making over-provisioning prohibitively expensive”article, stated

Keep the dedicated pod-based vector database architecture

Rejected because: Pods coupled storage and compute and required capacity planning, while serverless and turbopuffer lowered cost and simplified operations.

“serverless architecture that decoupled storage from compute and charged based on usage rather than uptime.”article, stated
“The added benefits of the serverless design included the removal of storage capacity constraints that had been a major scaling bottleneck”article, stated

Re-embed and reload entire pages after any edit

Rejected because: Most edits only changed part of a page or metadata; span hashes let Notion update only the necessary vectors or metadata.

“Previously, we would have re-embedded and loaded the whole page. Now, we chunk the page, get the previous state of the page from DynamoDB”article, stated
“we can skip embedding altogether, and just issue a PATCH command to our vector database to update the metadata”article, stated

Continue Spark plus third-party embeddings APIs for near-real-time indexing and query-time embeddings

Rejected because: That design created double compute, endpoint reliability dependence, clunky S3 handoffs, and an extra query-time API hop.

“Running Spark on EMR for preprocessing (chunking, transformations, orchestrating API calls), then also paying per-token fees to an embeddings API provider”article, stated
“Self-hosting embeddings removed a third-party API hop from the critical path, which materially reduced end-to-end latency for user-facing searches.”article, implied

Patterns

rag-retrieval (retrieval)

Vector search supplies semantic retrieval for Notion AI Q&A across workspace and connected-tool content.

“This is essential for Notion AI, which answers natural-language questions by searching content from across a user’s workspace and connected tools like Slack and Google Drive.”article, stated

cost-aware-routing (operations)

Notion moved vector infrastructure from uptime-priced dedicated pods to usage-priced serverless/object-storage-backed systems to control costs.

“In May 2024, we migrated our entire embeddings workload from the pre-existing dedicated-hardware “pod” architecture to a new serverless architecture that decoupled storage from compute and charged based on usage rather than uptime.”article, stated

batch-offline-processing (data-pipeline)

The migration used full re-indexing and increased offline indexing throughput to rebuild the corpus in turbopuffer.

“Full re-indexing: We increased our writes throughput in our offline indexing pipeline to rebuild the corpus in turbopuffer 2.”article, stated

Tradeoffs

Provision new index sets for onboarding rather than immediately reshaping existing shards.

Chose direct new workspace onboarding to newly provisioned index sets over incremental re-sharding or provisioning to final expected volume.

Rationale: The summary says this avoided the two unattractive options of repeated reshards or expensive final-volume provisioning.

“They chose a novel third approach: when index sets approached capacity, they provisioned entirely new sets and directed new workspace onboarding there.”summary, stated

Move from fixed pod capacity toward serverless and object-storage-backed vector search.

Chose serverless vector infrastructure and turbopuffer over dedicated hardware pod clusters.

Rationale: Dedicated pods coupled storage and compute and charged for uptime; serverless/turbopuffer reduced cost and removed capacity constraints.

“serverless architecture that decoupled storage from compute and charged based on usage rather than uptime.”article, stated
“turbopuffer was a newer entrant in the search space, built from the ground up on top of object storage for performance and cost-efficiency.”article, implied

Track page state hashes before re-embedding.

Chose span-level text and metadata hashes in DynamoDB over re-chunking, re-embedding, and re-uploading every span after any page edit.

Rationale: Hash comparison let Notion distinguish text changes from metadata changes and skip expensive embedding work when possible.

“To detect changes, we kept track of two hashes per span: one on the span text, and the other on all of the metadata fields.”article, stated
“we can skip embedding altogether, and just issue a PATCH command to our vector database to update the metadata”article, stated

Bring embedding generation and serving onto Ray.

Chose Ray/Anyscale and Ray Serve for embeddings over Spark preprocessing plus external embedding endpoints.

Rationale: Ray reduced double compute, improved model flexibility, and removed a third-party query-time hop at the cost of operating a more direct ML platform path.

“Running Spark on EMR for preprocessing (chunking, transformations, orchestrating API calls), then also paying per-token fees to an embeddings API provider”article, stated
“Ray lets us run open-source embedding models directly, without being gated by external providers.”article, implied

Gotchas (what bit them)

Dedicated vector indexes created capacity pressure immediately after launch.

Root cause: Storage and compute were coupled in pod clusters, and demand produced a multi-million-workspace waitlist.

Resolution: Notion first provisioned new index sets for new workspaces, then migrated to serverless and turbopuffer architectures.

“We quickly accumulated a waitlist of millions of workspaces eager to access Q&A, and we needed to onboard them as quickly as possible while maintaining quality and performance.”article, stated

Evaluation

Notion evaluated search-engine alternatives and committed to turbopuffer after successful evaluation.

Metrics: cost · latency · capacity · write throughput

“After a successful evaluation, we committed to migrating our entire multi billion object workload to turbopuffer in late 2024.”article, stated

Outcomes

The system supports AI Q&A across Notion workspaces and connected tools.

“This is the story of how we scaled our vector search infrastructure by 10x while simultaneously reducing costs by 90 percent over the past two years.”article, stated