Scaling vector search beyond tens of millions of high-dimensional embeddings inevitably hits a physical boundary: the single-node memory wall. Because graph-based approximate nearest neighbor (ANN) algorithms such as Hierarchical Navigable Small World (HNSW) require random memory access patterns across graph vertices and high-dimensional vectors, keeping embeddings and index structures in RAM is critical for sub-20ms query latencies.
A collection of 100 million 1,536-dimensional float32 vectors requires approximately 614 GB of raw storage solely for the vector coordinates. When adding HNSW graph adjacency lists, index metadata, and vector payload attributes, the in-memory footprint routinely exceeds 900 GB to 1.2 TB. When dataset scale surpasses what can economically or practically reside on a single compute instance, engineering teams must transition from vertical hardware scaling to distributed sharding architectures.
Designing a distributed vector search cluster introduces complex trade-offs between scatter-gather latency amplification, partition pruning, memory fragmentation, and write-time indexing contention.
Horizontal Partitioning Topologies
Partitioning vector data across a cluster requires selecting a distribution strategy that balances ingestion uniformity against query-time fan-out.
+-----------------------------------------------------------------------+
| Horizontal Partitioning Models |
+-----------------------------------------------------------------------+
| 1. Random / Round-Robin: Uniform data spread; 100% query broadcast. |
| 2. Consistent Hash: Deterministic ID lookup; 100% query broadcast. |
| 3. Shard / Partition Keys: Deterministic routing; 1-shard targeted. |
| 4. Semantic / Voronoi: Centroid-based; risk of boundary recall drop. |
+-----------------------------------------------------------------------+Random and Hash-Based Sharding
The simplest distribution model assigns incoming vectors to shards randomly or via consistent hashing over the document identifier. This approach guarantees an even distribution of data and write throughput across all data nodes in the cluster.
However, because vector similarity is metric-space dependent and uncorrelated with document IDs, hash-based sharding provides no semantic locality. Every similarity search query must be broadcast to every shard in the cluster. This 100% broadcast requirement turns every query into a distributed scatter-gather operation.
Custom Shard Keys and Metadata Partitioning
To avoid cluster-wide broadcast, modern vector engines implement deterministic routing via shard keys, such as Qdrant Custom Sharding and Milvus Partition Keys.
Under this pattern, vectors are partitioned based on a categorical metadata field, such as tenant_id, user_id, or region. When an incoming query specifies a filter matching the partition key, the coordinator proxy routes the search request exclusively to the specific shard holding that partition.
Targeted shard routing reduces network overhead and compute utilization from shards down to . For multi-tenant applications where search scopes are isolated per organization, partition keys eliminate scatter-gather bottlenecks entirely.
Semantic and Centroid-Based Partitioning
An alternative approach partitions the vector space geometrically using coarse quantization (such as k-means centroids or Voronoi cells). Queries are first compared against cluster centroids, and execution is routed only to the shards whose Voronoi regions are proximate to the query vector.
While semantic partitioning reduces query fan-out without requiring explicit tenant keys, it introduces severe production failure modes:
- Recall Degradation at Boundaries: Vectors near cluster borders require searching multiple neighboring shards. Omitting adjacent partitions causes immediate recall drops.
- Data Skew and Hotspots: Real-world embeddings cluster around dense semantic regions, causing specific shards to receive disproportionate storage and query traffic.
- Re-clustering Overhead: As the embedding distribution shifts over time, centroids drift, requiring expensive global dataset re-indexing.
The Scatter-Gather Bottleneck and Latency Tail Mathematics
When queries cannot be pruned to a single partition, the system must execute a distributed scatter-gather workflow across shards.

The Distributed Query Workflow
The scatter-gather execution cycle proceeds across three primary stages:
- Query Fan-Out: The stateless coordinator proxy receives the query vector and search parameters (top-, distance metric, metadata filters), serializes the request, and dispatches it concurrently to all target shard worker nodes.
- Local Segment Execution: Each worker node executes a local ANN search against its resident index segments, identifying its local top- nearest candidates.
- Global Reduce: Each worker returns its candidate list ( IDs and distance scores) over the internal network to the proxy. The proxy merges the sorted arrays using a min-heap or priority queue to produce the final global top- result set.
Tail Latency Amplification
In a distributed scatter-gather system, query completion is bounded by the slowest responding shard. If represents the latency of shard , the total query latency is:
If each individual shard has an independent probability of experiencing a latency outlier exceeding threshold (due to garbage collection, cache misses, or background compaction), the probability that at least one of the shards experiences an outlier is:
For a cluster sharded across 16 nodes with an individual node p99 outlier rate of 1% ():
Nearly 15% of all cluster queries will experience tail latency delays, degrading the effective cluster-level 99th percentile far beyond the single-node profile.
Empirical evaluation in When More Cores Hurts: The Vector Database Scaling Paradox in HPC (arXiv:2606.08950) demonstrates this phenomenon: when partitioning an 88-million vector dataset across increasing segment counts (from 1 to 8 segments), search latency increased from 4.19 seconds to 22.65 seconds due to partition fan-out, memory bus saturation, and synchronization overhead.
Segment Architecture vs. Monolithic Shard Graphs
Production vector engines organize shard storage into segments to manage data ingestion and index lifecycle.
+-----------------------------------------------------------------------+
| Shard Segment Topology |
+-----------------------------------------------------------------------+
| [Incoming Writes] |
| │ |
| ▼ |
| ┌─────────────────────────┐ ┌──────────────────────────────┐ |
| │ Growing / Unindexed │ ──Flush─▶│ Sealed / Immutable Segments │ |
| │ Segment (MemTable/WAL) │ │ (HNSW / DiskANN / Quantized) │ |
| │ (Exhaustive Scan) │ │ (Graph Traversal) │ |
| └─────────────────────────┘ └──────────────────────────────┘ |
+-----------------------------------------------------------------------+Growing vs. Sealed Segments
When new vectors are inserted into systems like Milvus or Qdrant, building an HNSW graph incrementally for every single write introduces lock contention on graph neighbor arrays. To maintain high ingestion throughput:
- Growing Segments: Incoming vectors are written to an append-only write-ahead log (WAL) and an in-memory buffer without an ANN graph. Queries hitting growing segments must perform a brute-force flat scan.
- Sealed Segments: Once a growing segment reaches a configured threshold (e.g., 512 MB or 1 million vectors), it is sealed, marked immutable, and handed off to background index workers to construct the HNSW or quantized index.
Ingestion Contention and Query Degradation
During continuous high-volume ingestion, the presence of unindexed vectors in growing segments creates immediate tail latency spikes.
The empirical benchmark in When More Cores Hurts (arXiv:2606.08950) highlights this trade-off: under concurrent insertion and querying, Milvus, Weaviate, and Qdrant experience significant performance shifts. While Weaviate updates active HNSW graphs in-place (creating memory contention), Qdrant and Milvus isolate writes into growing segments, trading short-term brute-force scan overhead on small buffers for predictable bulk indexing throughput.
In decoupled architectures like Milvus Storage/Compute Disaggregation, index building is entirely offloaded to dedicated IndexNode pools, preventing CPU-intensive graph construction from stealing cycles from QueryNodes.
Filter Pushdown and Selective Shard Traversal
Vector search queries in production rarely execute in isolation; they almost always include business logic filters (e.g., status = "active" AND created_at > 1700000000).
+-----------------------------------------------------------------------+
| Metadata Filtering Strategies |
+-----------------------------------------------------------------------+
| 1. Pre-Filtering: Inverted index scan first -> vector search on set. |
| Pitfall: Inefficient if filter matches 90% of entire dataset. |
| |
| 2. Post-Filtering: Global ANN top-K -> prune non-matching items. |
| Pitfall: May return fewer than K results if filter is selective. |
| |
| 3. Integrated / Single-Stage Filtering: Traverse HNSW graph while |
| checking bitset masks in the inner distance evaluation loop. |
| Optimal: Balances recall guarantees and traversal speed. |
+-----------------------------------------------------------------------+Integrated Single-Stage Filtering
In integrated filtering, the query engine evaluates payload boolean conditions during the graph exploration phase. A bitset or roaring bitmap representing matching document IDs is constructed prior to graph traversal. As the algorithm explores neighboring vertices in the HNSW layer, it skips non-matching candidates from the candidate queue while maintaining graph connectivity.
When distributed across shards, the coordinator pushes filter ASTs down to individual query nodes. If a shard's metadata index indicates zero matching documents within its local segments, the shard aborts vector distance calculations immediately, returning an empty result set in sub-millisecond time.
Dynamic Shard Rebalancing and High Availability
Maintaining low latency and fault tolerance across distributed vector clusters requires robust consensus, replication, and data migration mechanisms.
Consensus and Topology Management
Distributed vector databases rely on consensus layers—such as Raft in Qdrant or etcd in Milvus—to track cluster topology, shard assignments, and node health states. The consensus engine maintains a centralized routing table mapping collections, shards, and replica locations across physical nodes.
Shard Migration Under Live Traffic
When a node experiences resource exhaustion or hardware degradation, the cluster orchestrates dynamic shard migration without downtime:
- Snapshot Creation: The source node creates an immutable snapshot of the target shard's sealed segments and index files.
- Bulk Transfer: The snapshot is streamed over the network to the destination node. During transfer, the source node continues serving read and write traffic.
- Delta Sync & Catch-Up: Writes occurring during the bulk transfer are recorded in a local replication buffer and streamed to the destination node.
- Raft State Cutover: Once the destination replica's replication lag reaches zero, a Raft consensus transaction updates the cluster routing table, redirecting coordinator traffic to the new shard location and decommissioning the old instance.
Read Replicas and Bounded Staleness
To scale read throughput independently of dataset size, shards are assigned replication factors (). The proxy coordinator balances read queries across replica sets using round-robin, least-loaded, or latency-aware routing.
Systems allow tunable consistency levels:
- Strong Consistency: Queries read exclusively from shards that have acknowledged all writes up to the current timestamp oracle (TSO) checkpoint.
- Bounded Staleness / Eventual Consistency: Queries execute against local replica state, achieving higher throughput and lower p99 latency by avoiding distributed synchronization barriers.
Production Sizing and Capacity Planning
Estimating hardware and network capacity for a distributed vector cluster requires accounting for vector dimensions, graph parameters, payload size, and network serialization overhead.
+-----------------------------------------------------------------------+
| Vector Cluster Sizing Equations |
+-----------------------------------------------------------------------+
| Raw Vectors (Bytes) = Count * Dimension * 4 (float32) |
| HNSW Index (Bytes) = Count * M * 2 * 4 (bidirectional edges) + Meta |
| Shard VRAM/RAM (GB) = (Raw Vectors + HNSW Graph + Payloads) * 1.35 |
| Network Bandwidth = QPS * Top-K * (Vector ID + Payload Size) |
+-----------------------------------------------------------------------+Memory Sizing Formula
For a collection with vectors of dimensionality :
- Raw Vector Memory:
- HNSW Edge Memory: For connectivity parameter (typically 16 to 64), each node stores up to bidirectional edge pointers:
- Buffer Overhead: Add a 30% to 40% headroom multiplier to accommodate growing segment buffers, OS page cache, query execution heaps, and merge priority queues.
For 100 million 1536-dimensional vectors with :
- Total Memory Requirement with headroom:
Distributed across 8 query nodes, each node requires at least 128 GB of RAM to sustain in-memory graph search.
Network and Coordinator Throughput
At high query volumes (e.g., 2,000 QPS with top-), the coordinator proxy must ingest, deserialize, and merge candidate records per second.
To prevent coordinator CPU saturation:
- Use binary serialization protocols (gRPC with Protobuf or FlatBuffers) over raw JSON.
- Avoid returning full payload attributes during the initial vector search phase; retrieve document IDs and distance scores first, perform the global reduce, and fetch full payload blobs only for the final top- items.
- Deploy proxy instances behind a Layer 4 load balancer to scale query ingestion horizontally.
Architecture Decision Matrix
+-------------------+--------------------+--------------------+--------------------+
| Parameter | Single-Node | Custom Sharding | Global Scatter- |
| | (pgvector/Qdrant) | (Tenant Keys) | Gather (Milvus) |
+-------------------+--------------------+--------------------+--------------------+
| Target Vector Vol | < 10M - 20M | 10M - 1B+ | 100M - 10B+ |
| Query Fan-Out | None (Local) | Single Shard | All Shards (N) |
| Tail Latency (p99)| Predictable / Low | Isolated / Low | Amplified (Max N) |
| Memory Footprint | Single Box Limit | Distributed Nodes | Disaggregated Pods |
| Ingestion Scaling | Limited by Disk/CPU| Partition-Isolated | Independent WAL/ |
| | | | Index Nodes |
+-------------------+--------------------+--------------------+--------------------+


