HNSW and IVFFlat, covered earlier in this course, both assume the index fits in RAM. That assumption breaks at billion-scale: a billion 768-dimensional float32 embeddings alone is roughly 3TB, before the graph or cluster structure adds anything on top. Buying enough RAM to hold that is possible but expensive. The alternative that's actually shipped in production is DiskANN, Microsoft's disk-based approximate nearest neighbor system, which deliberately keeps most of the index on NVMe SSD instead of in memory.
The Actual Mechanism
DiskANN's original research paper describes indexing, storing, and searching a billion-point database "on a single workstation with just 64GB RAM and an inexpensive solid-state drive." The trick isn't that SSDs are as fast as RAM — they're not — it's a split: a compressed version of every vector stays in RAM for a fast first-pass filter, while the graph structure and full-precision vectors live on the NVMe drive, read only for the small number of candidates the compressed search narrows things down to. On the standard billion-point SIFT1B benchmark, the paper reports over 5,000 queries per second at under 3ms mean latency and 95%+ recall on a 16-core machine — numbers that depend heavily on NVMe's random-read performance being fast enough that those disk reads don't dominate the query.
Why This Only Works Well on NVMe, Not Spinning Disk or SATA SSD
The "sub-millisecond disk read" part of this equation is the whole reason the technique is viable. A query in DiskANN's graph traversal issues several small, effectively-random reads per hop as it walks the graph on disk. NVMe drives, which connect over PCIe and support deep queued parallel I/O, handle that access pattern at latencies low enough (tens of microseconds) that it doesn't dominate total query time. The same access pattern against a spinning hard drive, with its physical seek time, would be unusably slow — this is specifically an NVMe-era technique, not a generic "use disk instead of RAM" trick.
# Rough shape of the trade-off DiskANN is built around:
#
# All-in-RAM HNSW: fastest per-query, but RAM cost scales
# linearly with dataset size
# DiskANN (RAM+NVMe): compressed vectors in RAM for filtering,
# full vectors + graph read from NVMe on demand
# -> ~10x+ more vectors served per machine,
# at a real but small added per-query latency
| Storage Tier | Typical Random-Read Latency | Fit for Graph-Traversal ANN |
|---|---|---|
| RAM | ~100 nanoseconds | Fastest, but capacity-limited and expensive at billion-vector scale |
| NVMe SSD | Tens of microseconds | What DiskANN is built for — fast enough for per-hop graph reads |
| SATA SSD / spinning disk | Hundreds of microseconds to several milliseconds | Too slow for the random per-hop access pattern graph traversal needs |
The practical takeaway for anyone sizing a local vector search cluster: if your dataset comfortably fits in RAM, a standard in-memory HNSW index (as covered earlier in this course) is simpler and faster per query. DiskANN and disk-based ANN techniques earn their added complexity specifically once RAM cost becomes the binding constraint — and even then, they depend on NVMe-class storage to keep the added disk-read latency small enough to matter.
Practical Challenge
Estimate the RAM cost of storing 100 million 768-dimensional float32 embeddings in memory (dimensions × 4 bytes × count), then compare that to what an NVMe drive of the same capacity costs — this is the actual economic trade-off DiskANN-style systems are built to address.
Concept Check
Sources & Further Reading
- DiskANN: Fast Accurate Billion-point Nearest Neighbor Search on a Single Node (Microsoft Research) — original paper with the 64GB RAM / SSD billion-point claim and the SIFT1B throughput/latency/recall numbers cited above.
- DiskANN GitHub repository — open-source implementation (MIT license) confirming current project status and technique.
AI