DEV Community

Cover image for Milvus vs Qdrant in Production: HNSW, DiskANN & Multi-Tenancy
Amir Mehmood
Amir Mehmood

Posted on Originally published at hostingpodium.com

Milvus vs Qdrant in Production: HNSW, DiskANN & Multi-Tenancy

Originally published on the HostingPodium Enterprise Engineering Blog.

Free SRE & Developer Diagnostics: Test your stack live with our Rich Snippets Generator & Schema.org JSON-LD Creator, Free Website Speed & Core Web Vitals Checker, or explore all 9 Free Webmaster & Cloud Engineering Tools.

An authoritative engineering guide analyzing Milvus and Qdrant production architectures, focusing on HNSW memory optimization, SQ8 quantization, DiskANN, and secure multi-tenancy.


Architectural Foundations of Enterprise Vector Engines

Designing large-scale production vector database infrastructure requires rigorous evaluation of memory footprints, index construction throughput, and query-time P99 latency. Both Milvus and Qdrant provide high-performance vector similarity search capabilities, but their underlying memory management models, indexing primitives, and scale-out strategies differ fundamentally. HostingPodium infrastructure engineering teams routinely benchmark these systems against datasets exceeding one billion vectors to determine optimal placement under stringent SLAs.

Milvus operates on a decoupled storage and compute architecture. It separates stateful components—such as query nodes, data nodes, and index nodes—from stateless proxies, utilizing Apache BookKeeper and distributed object storage for write-ahead logging and persistent segment storage. This separation allows horizontal elasticity, making Milvus well-suited for massive, multi-tenant deployments where ingestion throughput scales independently of search concurrency. Qdrant, conversely, is engineered on a rust-native, shared-disk or shared-nothing sharded architecture using the tonic gRPC framework and Tokio asynchronous runtime. Qdrant embeds the vector index and payloads within a unified storage engine per shard, yielding deterministic low-latency memory access patterns and predictable CPU cache utilization.

Memory Subsystems and Index Mechanics

The primary operational expenditure in vector search infrastructure is RAM. Exact k-NN search is computationally prohibitive at scale, necessitating approximate nearest neighbor (ANN) algorithms. Both engines rely primarily on Hierarchical Navigable Small World (HNSW) graphs due to their superior recall-latency trade-offs. However, the memory overhead of maintaining raw floating-point vectors alongside HNSW graph links often exceeds physical RAM capacity per node, forcing architectures toward quantization and memory-mapped disk indices.

Memory consumption for an uncompressed HNSW index can be calculated using the following baseline metric:

Memory (Bytes) = Vector Count * (Dimensions * sizeof(datatype) + M * 2 * sizeof(uint32_t) + overhead)
Enter fullscreen mode Exit fullscreen mode

Where M represents the maximum number of bi-directional links created per node during construction. For a 1536-dimensional float32 vector with M=16, raw memory consumption rapidly saturates system memory. To mitigate this, production deployments implement Scalar Quantization (SQ8) or Product Quantization (PQ), alongside memory-mapped (mmap) index files.

Comparative Analysis: Milvus vs Qdrant Benchmarks

Production benchmarks across identical bare-metal nodes (dual AMD EPYC 9654, 768GB RAM, NVMe U.2 RAID0 storage) demonstrate distinct operational profiles for milvus vs qdrant benchmark scenarios. When indexing 100 million 768-dimensional vectors:

  • Milvus (Knowhere engine): Demonstrates superior index build throughput when leveraging distributed index nodes, completing HNSW construction in 42 minutes. Memory consumption during build requires 1.8x the dataset size, necessitating careful autoscaling of index node memory limits.
  • Qdrant (Rust implementation): Achieves lower P99 query latency (under 8ms at QPS=1000) when utilizing local RAM-resident HNSW indices. Qdrant's memory footprint is more deterministic due to Rust's lack of a garbage collector, though unoptimized payload indexing can inflate RAM usage.
Metric Milvus (Distributed) Qdrant (Standalone/Sharded)
Primary Language C++ (Knowhere) / Go Rust
Storage Backend MinIO / S3 / BookKeeper Local NVMe / Shared Disk
Quantization Support SQ8, SQ, PQ, DiskANN SQ8, SQ4, Binary, DiskANN
Multi-Tenancy Model Collections / Partitions / Dynamic Fields Payload Schemas / Shard Keys
Scaling Model Disaggregated Compute/Storage Horizontal Sharding via Raft

Scalar Quantization and Memory-Mapped DiskANN

When dataset sizes exceed cluster RAM capacity, maintaining indices in memory becomes economically unviable. Both engines provide alternative storage paradigms: scalar quantization sq8 product quantization and memory-mapped diskann vector index configurations.

Scalar Quantization (SQ8) compresses 32-bit floating-point vectors into 8-bit integers, reducing the vector memory footprint by approximately 75% with a marginal drop in recall (typically under 1% loss on standard benchmarks like GloVe or SIFT). Qdrant implements SQ8 natively within its segment storage, allowing direct SIMD-accelerated distance calculations (AVX-512) over compressed byte arrays without full dequantization.

For ultra-large datasets, DiskANN provides graph-based search anchored directly on high-speed NVMe storage. Milvus integrates DiskANN via its Knowhere library, relying on direct asynchronous I/O (io_uring) to fetch vector data from disk during graph traversal. Qdrant utilizes mmap-backed storage where the operating system virtual memory subsystem pages HNSW graph layers directly from NVMe block devices into page cache.

Operational Configuration: Qdrant SQ8 and Mmap

Below is a production-grade Qdrant collection configuration utilizing SQ8 quantization and memory-mapped storage to optimize density:

PUT /collections/enterprise_vectors
{
 "vectors": {
 "size": 1536,
 "distance": "Cosine",
 "hnsw_config": {
 "m": 16,
 "ef_construct": 200,
 "full_scan_threshold": 10000
 },
 "quantization_config": {
 "scalar": {
 "type": "int8",
 "quantile": 0.99,
 "always_ram": true
 }
 },
 "storage_config": {
 "payload_storage": "mmap"
 }
 }
}
Enter fullscreen mode Exit fullscreen mode

Operational Configuration: Milvus DiskANN and SQ8

In Milvus, configuring a collection with scalar quantization and disk-based indexing requires defining collection schema properties explicitly through PyMilvus:

from pymilvus import FieldSchema, CollectionSchema, DataType, Collection, utility

fields = [
 FieldSchema(name="id", dtype=DataType.INT64, is_primary=True, auto_id=False),
 FieldSchema(name="vector", dtype=DataType.FLOAT_VECTOR, dim=1536),
 FieldSchema(name="tenant_id", dtype=DataType.VARCHAR, max_length=64)
]
schema = CollectionSchema(fields=fields, description="Enterprise Multi-Tenant Collection")
collection = Collection(name="production_vectors", schema=schema)

index_params = {
 "metric_type": "COSINE",
 "index_type": "DISKANN",
 "params": {"search_list": 100}
}
collection.create_index(field_name="vector", index_params=index_params)
Enter fullscreen mode Exit fullscreen mode

Multi-Tenant Payload Filtering and Isolation Strategies

Multi-tenancy implementation dictates both query performance and security posture. Tenants share underlying cluster infrastructure, but data isolation must be cryptographically and logically guaranteed. Furthermore, filtering vectors by tenant metadata during similarity search can lead to performance degradation if not optimized.

Post-filtering (executing the vector search across the entire index and subsequently removing unauthorized tenant records) fails when tenant selectivity is low, frequently returning zero results if the top-k matches belong to other tenants. Pre-filtering (restricting the vector search space strictly to the target tenant's subset) ensures accurate recall but introduces severe graph traversal fragmentation if indices are not pre-partitioned.

  • Milvus Multi-Tenancy: Supports partition keys and dynamic fields. Partition keys automatically hash tenants into distinct physical segments within a collection, enabling efficient pre-filtering without creating millions of discrete collections.
  • Qdrant Multi-Tenancy: Utilizes shard keys and Payload Indexing. Qdrant allows routing requests to specific shards based on tenant IDs, combined with inverted index payloads. Payload indices ensure filtered searches bypass unindexed sequential scans entirely.

Qdrant payload index configuration for high-cardinality tenant isolation:

PUT /collections/enterprise_vectors/index
{
 "field_name": "tenant_id",
 "field_schema": "keyword"
}
Enter fullscreen mode Exit fullscreen mode

When querying with payload filtering in Qdrant, the engine evaluates the payload index first, intersecting the posting list with the HNSW graph entry points:

POST /collections/enterprise_vectors/points/search
{
 "vector": [0.02, 0.11, ..., 0.45],
 "filter": {
 "must": [
 {
 "key": "tenant_id",
 "match": {
 "value": "tenant_9842af"
 }
 }
 ]
 },
 "limit": 10,
 "with_payload": true
}
Enter fullscreen mode Exit fullscreen mode

Runbook: Troubleshooting P99 Latency Spikes and OOM Events

Production vector database clusters face distinct failure modes, primarily driven by memory exhaustion and garbage collection pauses in unoptimized runtimes, or block I/O saturation in disk-backed architectures.

Runbook Item 1: Mitigating Out-Of-Memory (OOM) Kills in Index Nodes

Symptoms: Kernel OOM killer terminates Milvus Index Nodes or Qdrant worker processes during bulk ingestion or HNSW index building.

Root Cause: HNSW build memory multiplier exceeds node memory allocation. Dynamic index building requires up to 3x raw vector size in temporary RAM buffers.

Remediation Steps:

  • Enforce strict cgroup memory limits and configure swap constraints (vm.swappiness=1).

  • Reduce batch insertion sizes in client applications from 10,000 to 2,000 vectors to flatten peak memory allocation curves.

  • Implement scalar quantization prior to index building by setting auto_index = true with SQ8 parameters.

Runbook Item 2: Resolving IOPS Saturation on NVMe DiskANN/Mmap Deployments

Symptoms: P99 search latency climbs above 100ms; node CPU utilization drops while disk iowait exceeds 40%.

Root Cause: Operating system page cache eviction forces frequent random read operations against underlying NVMe storage blocks during graph traversal.

Remediation Steps:

  • Verify block device scheduler settings. Ensure NVMe drives utilize the none or bfq scheduler with optimized queue depth:
echo none > /sys/block/nvme0n1/queue/scheduler
echo 1024 > /sys/block/nvme0n1/queue/nr_requests
Enter fullscreen mode Exit fullscreen mode
  • Increase host system memory to accommodate a higher percentage of the active working set within page cache, or decrease M parameter in HNSW configuration to reduce graph connectivity overhead.

  • Migrate high-frequency tenant shards entirely to RAM-backed collections while pushing cold, archival tenants to object-storage-backed segments.


Free Webmaster, SRE & Cloud Diagnostic Tools (No Signup Required)

Verify and benchmark your production infrastructure directly from your browser using the HostingPodium Free Webmaster & Developer Suite:

Free Engineering Utility Primary Diagnostic Use Case
Global DNS Propagation & SSL Checker Verify live A, AAAA, CNAME, MX, TXT, NS & CAA records across 21+ global resolvers + TLS certificate audits
Website Speed Test & Core Web Vitals Auditor Measure server TTFB, LCP, INP, CLS, and HTTP/2 compression latency in real time
Rich Snippets & Schema.org JSON-LD Generator Generate & validate structured JSON-LD markup for TechArticles, FAQs, Products & Organizations
HTTP Redirect Chain & Status Code Tracer Trace 301/302 redirect hops, inspect response headers, and verify load balancer health checks
DMARC, SPF & DKIM Email Security Validator Audit domain email authentication policies and generate compliant DMARC records
Google SERP Simulator & Meta Tag Previewer Preview desktop/mobile Google snippets, OpenGraph cards, and pixel-width truncation
Free WebP Image Converter & Optimizer Client-side PNG/JPG to WebP compression for faster Core Web Vitals LCP

Related Enterprise Architecture & Benchmarks

Top comments (0)