AI apps · SDE-3 · Queue chunks before quota-limited embedding
Design a RAG Ingestion Pipeline system design, running live
The upload handler stores each parsed chunk in S3 and puts it on a queue, so uploads finish in about a tenth of a second however busy the model is. A second function reads the queue with its concurrency capped at 20: each call holds one for about a quarter of a second, so it embeds about 87 chunks a second, under the 100 a second the quota allows, and writes each vector to the index. During the upload the queue grows instead of the model throttling, then drains. The quota sets the pace: at 6,000 chunks a minute, every 360,000 chunks take an hour whatever you build. The queue makes that a wait instead of lost chunks.
An illustrative teaching design, not a verified diagram of any company's internal architecture. Traffic, capacity and cost are simulator estimates. Model and assumptions.
- Traffic
- 20 req/sSmall scale
- AWS bill
- $1,115/mo
- p99
- 120 ms
- Components
- 6
The challenge models 20 chunks a second normally and a temporary 500 chunks a second upload; 6,000 embedding requests per minute is the fixed quota assumption.
How it works
- The upload handler stores parsed chunks and enqueues work without waiting for embeddings.
- A concurrency-limited function reads the queue and calls the embedding model.
- The worker writes completed vectors to the vector index while backlog drains after a burst.
What each part does
- Uploaded chunks
- Chunk uploads arrive at 20 per second normally and 500 per second during the challenge burst.
- Upload handler
- Stores parsed chunks and enqueues embedding work.
- Parsed chunks
- Durable storage for parsed chunks.
- Chunks to embed
- Buffers work until embedding capacity is available.
- Embedder
- Concurrency-limited consumer calls the embedding model.
- Embeddings
- Titan Text Embeddings V2 with the stated 6,000 requests per minute quota.
- Vector index
- Stores vectors for retrieval.
What breaks first
The embedder reaches the model quota as the input rate rises.
The model quota sets processing speed. The queue preserves work while it waits, but this blueprint does not simulate the challenge's 10,000-PDF burst or its completion goal.
The simulator checks this every build: it runs the design at 20 req/s, then ramps traffic to 10x (200 req/s) and records which part fails first. In the playground, press Break it to watch the same thing happen.
Trade-offs
What it gets right
- A queue absorbs uploads faster than the model quota allows.
- Separating upload and embedding work keeps upload latency independent of model throughput.
What it costs you
- The backlog can take time to drain after a large upload.
- The static graph does not execute the staged upload or guarantee exactly-once processing.
In the real world
- Document ingestion systems often separate upload, parsing, embedding, and indexing with durable queues.
- A queue changes when work is completed; it does not increase the embedding provider's quota.
In the interview
- Calculate quota in requests per second and compare it with chunk arrival rate.
- State how retries, idempotency, poison messages, and backlog alerts protect the pipeline.
Run it yourself
The playground opens this design with 20 requests a second already flowing. Press Break it, or change one part yourself, and watch which number goes first.
Questions people ask
How does Design a RAG Ingestion Pipeline work at the system design level?
The upload handler stores parsed chunks and enqueues work without waiting for embeddings. A concurrency-limited function reads the queue and calls the embedding model. The worker writes completed vectors to the vector index while backlog drains after a burst.
What breaks first in a Design a RAG Ingestion Pipeline design?
The embedder reaches the model quota as the input rate rises. The model quota sets processing speed. The queue preserves work while it waits, but this blueprint does not simulate the challenge's 10,000-PDF burst or its completion goal.
What are the trade-offs of this Design a RAG Ingestion Pipeline architecture?
A queue absorbs uploads faster than the model quota allows. Separating upload and embedding work keeps upload latency independent of model throughput. The backlog can take time to drain after a large upload. The static graph does not execute the staged upload or guarantee exactly-once processing.
What do interviewers look for in a Design a RAG Ingestion Pipeline system design answer?
Calculate quota in requests per second and compare it with chunk arrival rate. State how retries, idempotency, poison messages, and backlog alerts protect the pipeline.