Scaling RAG on Azure: 10,000 documents vs 10 million

Scaling RAG on Azure: 10,000 documents vs 10 million

Part 6 of 7 in the RAG in Production series: engineer-level, on Azure, mapped to Microsoft exam AI-103.

TL;DR for managers. At 10,000 documents, the infrastructure is small and cheap, and the work is in quality: chunking, hybrid search, re-ranking and evaluation. At 10 million documents the vectors alone can need hundreds of gigabytes, so compression, capacity planning and the time it takes to create the embeddings become first-order design decisions. The retrieval funnel stays the same. The engineering around it changes.

"Will it scale?" is a question that needs arithmetic, not adjectives. Below is the arithmetic, with the assumptions stated so you can swap in your own.

Assumptions. Average 10 chunks per document (around 500 tokens each). Embedding model text-embedding-3-small: 1,536 dimensions. Float32 = 4 bytes per dimension. Sizes are raw vector data; the HNSW graph and other copies add overhead on top, so treat these as lower bounds.

The numbers

def vector_gb(docs, chunks_per_doc=10, dims=1536, bytes_per_dim=4):
    return docs * chunks_per_doc * dims * bytes_per_dim / 1e9

for docs in (10_000, 1_000_000, 10_000_000):
    f32 = vector_gb(docs)
    print(f"{docs:>11,} docs  float32 {f32:7.1f} GB   int8 {f32/4:6.1f} GB   binary {f32/32:6.2f} GB")

#      10,000 docs  float32     0.6 GB   int8    0.2 GB   binary   0.02 GB
#   1,000,000 docs  float32    61.4 GB   int8   15.4 GB   binary   1.92 GB
#  10,000,000 docs  float32   614.4 GB   int8  153.6 GB   binary  19.20 GB
Documents Chunks float32 int8 (scalar, 4x) binary (1 bit)
10,000 100,000 0.6 GB 0.15 GB 0.02 GB
1,000,000 10 million 61 GB 15 GB 1.9 GB
10,000,000 100 million 614 GB 154 GB 19 GB

With text-embedding-3-large (3,072 dimensions), double every figure.

What Azure AI Search gives you

On the Dedicated tiers, vector quota is per partition, and you add partitions to get more. For services created after 17 May 2024 in most regions:

Tier Vector quota per partition Max partitions Max vector quota
Basic 5 GB 3 15 GB
S1 35 GB 12 420 GB
S2 150 GB 12 1.8 TB
S3 300 GB 12 3.6 TB
L1 / L2 (storage optimised) 150 / 300 GB 12 1.8 / 3.6 TB

A service can have at most 36 search units (replicas × partitions). Partitions add storage; replicas add query throughput and availability. The Serverless tier (billed since 13 September 2026) instead caps vector index size at 3 GB per index. Older services have lower limits, so check your service's creation date in the portal before planning.

10,000 documents: spend on quality, not infrastructure

100,000 chunks at 0.6 GB fits a Basic service with room to spare, or a single Serverless index. Exact search over 100,000 vectors is about 154 million multiply-adds per query, so exhaustive KNN is a reasonable choice and HNSW is optional. At this size:

  • Use integrated vectorisation (an indexer with the Text Split skill and an embedding skill) so ingestion is configuration, not code.
  • Run hybrid search plus the semantic ranker from day one. It costs one setting.
  • Put your effort into chunking and a golden question set (part 7). At this scale, quality problems are almost always chunking or retrieval settings, rarely capacity.
  • Re-embedding everything after a model change takes hours, so you can experiment freely.

10 million documents: five decisions you can't skip

1. Compress the vectors

614 GB of float32 needs S2 with 5 partitions before any graph overhead. Scalar quantisation to int8 cuts raw size 4x (154 GB: S1 with 5 to 6 partitions, or S2 with 2). Binary quantisation stores 1 bit per dimension; Microsoft quotes up to 28x smaller vector indexes and recommends it for embeddings above 1,024 dimensions. Compression loses some precision, which Azure offsets with oversampling and rescoring: fetch extra candidates with the compressed vectors, then rescore them with the full-precision originals.

2. Use fewer dimensions

The text-embedding-3 models were trained so that a truncated vector still works (Matryoshka Representation Learning). Azure supports this with truncationDimension. Going from 1,536 to 1,024 dimensions removes a third of the storage before quantisation. Measure recall before and after; don't assume.

"vectorSearch": {
  "algorithms": [ { "name": "hnsw-1", "kind": "hnsw",
    "hnswParameters": { "m": 4, "efConstruction": 400, "efSearch": 500, "metric": "cosine" } } ],
  "compressions": [ {
    "name": "sq-int8",
    "kind": "scalarQuantization",
    "scalarQuantizationParameters": { "quantizedDataType": "int8" },
    "truncationDimension": 1024,
    "rescoringOptions": {
      "enableRescoring": true,
      "defaultOversampling": 4,
      "rescoreStorageMethod": "preserveOriginals" } } ],
  "profiles": [ { "name": "big-profile", "algorithm": "hnsw-1",
                  "compression": "sq-int8", "vectorizer": "aoai" } ]
}

At query time, set oversampling per query if you want to override the default:

vq = VectorizableTextQuery(text=question, k_nearest_neighbors=50,
                           fields="content_vector", oversampling=4.0)  # 200 candidates, rescored, best 50 kept

3. Remove vector copies you don't need

Azure can keep up to three copies of each vector: the one in the HNSW graph, the source JSON (used to return vectors and for merge updates) and the full-precision originals for rescoring. Set stored: false on vector fields you never return in results. Use discardOriginals only if you accept losing full-precision rescoring.

4. Plan the embedding run

This is the one that catches teams out. 100 million chunks at 500 tokens is 50 billion tokens to embed:

chunks          = 100_000_000
tokens_per_chunk = 500
total_tokens    = chunks * tokens_per_chunk          # 50,000,000,000
tpm_quota       = 1_000_000                          # example only: check your deployment's quota
minutes         = total_tokens / tpm_quota           # 50,000 minutes
print(f"{minutes / 60 / 24:.1f} days at full quota") # 34.7 days

At an example quota of 1 million tokens per minute, that's about five weeks of continuous embedding, and every retry and rate-limit pause adds to it. Plan for parallel deployments, ingestion in priority order, and change detection so that only new or edited documents are embedded after the first load. Pin the embedding model version: changing it means re-embedding everything, because vectors from different models can't be compared.

5. Design filters and partitions for the questions people ask

At 100 million chunks, the cheapest relevance win is searching fewer of them. Store department, document type, region, date and security groups on every chunk, and pre-filter (part 3). If tenants never share data, one index per tenant or per business unit can be simpler to secure and to rebuild than one huge index. Also deduplicate at ingestion: large document stores contain many near-identical versions, and duplicates fill the re-ranker's 50 slots.

How I would size a real 10 million document project

  1. Load a representative 1% sample (100,000 documents, about a million chunks) with the compression settings you intend to use.
  2. Read the actual vector index size and storage from the portal's usage tiles or the index statistics API, and multiply by 100, with headroom.
  3. Run the evaluation set from part 7 at float32, int8 and binary, with and without truncation. Choose the smallest option that keeps retrieval quality where you need it.
  4. Price the tier and partitions in the Azure pricing calculator, then add replicas for your peak queries per second and for the SLA (two replicas for read, three for read and write).

The arithmetic above tells you which conversation to have. The 1% pilot tells you the actual answer.

Learning this for AI-103? Microsoft's AI-103 exam (Azure AI Apps and Agents Developer Associate) asks you to implement RAG, configure semantic, hybrid and vector search for grounding, and monitor relevance and grounding quality. Our live online AI-103 course builds these pipelines hands-on in Microsoft Foundry and Azure AI Search, on UK time, with mock assessments before you book the exam.

The RAG in Production series

  1. Part 1: RAG or fine-tuning?
  2. Part 2: The RAG retrieval funnel
  3. Part 3: Stage 1: ANN + BM25 hybrid search
  4. Part 4: Stage 2: Reciprocal Rank Fusion
  5. Part 5: Stage 3: re-ranking with cross-encoders
  6. Part 6: Scaling: 10,000 vs 10 million documents (you are here)
  7. Part 7: Evaluating RAG: retrieval vs generation
Back to blog

Ready to take the first step?

Live online courses on UK time, mapped to the current Microsoft AI exams. No coding needed for AI at work.

Explore AI coursesAsk us a question