Scale to Millions of Users
How an AI app grows from thousands of users to millions: web servers, data, model limits and cost, explained simply for your AI interview.
In short
Scaling to millions of users means adding capacity in layers: many stateless app servers behind a load balancer, caches and queues for the data, and a model layer that can be the first bottleneck. Watch rate limits, cache repeated work and keep a fallback ready.
13 min readAdvancedCommon · estimateFacts checked 27 November 2026
Say it out loud
Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.
Scaling to millions of users means adding capacity in layers. Many identical web servers sit behind a load balancer, so no single one gets overloaded. Caches and read copies take repeat reads off the database. The model can be the first bottleneck, because each answer costs compute and providers limit how fast you can call them. So I watch the limits, queue the work that can wait, retry after a random short pause, cache repeated prompts, and keep a second provider ready.
I start with the traffic path, because that is where growth breaks first. The web servers should hold no user state of their own, so any server can take any request. A load balancer spreads traffic across them and stops sending work to servers that fail health checks. Auto scaling adds servers when load rises and removes them when it falls. That covers the web tier, and it is the easy part.
The data layer is next. A cache keeps answers to common questions close at hand, so the same question does not hit the database or the model again. Read copies of the database let reads spread out, but a copy can trail the main database for a moment, so I decide which reads can accept slightly old data. Work that does not need an answer now, like overnight summaries, goes into a queue.
The model is the hard part. Providers limit how many tokens you can send per minute, and a sharp spike returns 429 errors. So I cap each team and user in my own code, queue the non-urgent work, retry, waiting a little longer each time and adding a random pause, so clients do not all retry together, and keep a second provider as a fallback. Prompt caching cuts cost and latency for long prompts that repeat, and I track cost per answer from day one.
For a bank's support assistant with two million customers, I would plan for about 1,200 requests a second at peak, using a made-up figure of 80 requests a second per server, and add 30 percent headroom. Then I load test before launch, because the numbers that matter are the ones I measure.
What does scaling to millions of users mean, in plain words?
Scaling means your app keeps working as more people use it, without getting slow or breaking. Going from a few thousand users to millions takes many small changes, each one placed where the load lands next.
Picture a busy bank branch on the first Monday of the month. One teller can serve only so many people an hour. So the branch opens more counters, puts a person at the door to send each customer to a free counter, and sets up a separate queue for forms that need no teller at all. The building stays the same size, but it gains more ways to take the load.
For an AI app, the teller that runs out first can be the model, the AI that writes each answer. Its limits count tokens, the small pieces of text it reads and writes, roughly a word or part of one. So the plan has to cover three layers: the web servers, the data, and the model.
Key words
- Stateless server
- A server that keeps no user session in its own memory, so any copy can answer any request.
- Load balancer
- The front door that spreads incoming requests across many servers. It pings each one regularly (a health check) and skips any that stop answering.
- Cache
- A fast store of answers you already worked out, so you don't do the same work twice.
- Rate limit
- A cap on how many requests a user or team can send in a set time window.
- Queue
- A line where jobs wait to be picked up, so a spike makes the line longer instead of crashing the app.
How do you spread web traffic across many servers?
Start with the web tier. Keep the servers stateless, so the chat history and the login live in a shared store, not in one server's memory. Then any copy can take the next message, and you add copies as the load grows.
A load balancer does the spreading. It sends each request to a healthy server, and auto scaling (adding and removing servers to match the load) makes sure the number of servers follows the day's load, up in the morning and down at night.
How a chat request reaches the model
2 million customers
made-up peak: 1,200 a second
Load balancer
spreads requests, skips sick servers
Web tier
App servers
keep no chat history themselves
Auto scaling
adds servers as load rises
Cache and model
Answer cache
repeat questions answered at once
Model
the slow, metered step
Reply to customer
in a moment, not a queue
- 1The customer's message reaches the front door.
- 2The load balancer hands it to a healthy server.
- 3The app checks for a saved answer first.
- 4A saved answer goes straight back to the customer.
- 5A miss sends the question on to the model.
- 6The model's answer goes back to the customer.
Worked example. A bank's support assistant serves 2 million customers. Made-up planning figures put the peak at 1,200 requests a second, and one server handles 80 of them. That needs 15 servers. Add 30 percent headroom and you run 20. The load balancer stops sending work to any server that fails its health check, so one dead machine costs a little capacity, and the service keeps running.
Tip
Don't plan around one very big server. Growing one machine upward has a ceiling, and when it fails, every customer fails with it.
What do you do about the database and repeat work?
Most support traffic repeats. Many customers ask the same handful of questions about fees, card limits and opening hours. A cache keeps those answers, so the reply comes from memory and the model is not called. A cache must never hand one customer's private data to another, so each saved answer is labelled with the customer it belongs to, and only public answers are shared.
- Cache
Saved answers, very fast
Keeps the result of work already done. A miss means doing the work again.
- Read copy
Copies of the database
Spreads reads over copies of the main database. A copy can trail the main one for a moment, so reads may be a little old.
Use a cache when the same question keeps coming back. Use read copies when reads can accept a little delay and the main database is busy with reads. Both take load off the main database, but neither removes the need to size it.
Work that doesn't need an answer now goes into a queue. A queue holds the jobs and lets workers take them at a pace the system can handle. A spike makes the line longer rather than crashing the app, and the jobs still finish.
Worked example. A call centre with 40,000 calls a day wants a summary for each call. The summaries run from the queue overnight, when load is low, and the morning dashboard reads from a read copy. The live chat database keeps its headroom for customers.
Why is the model the hardest part to scale?
A model call is slow, and it is metered. Anthropic describes its limits as requests per minute, input tokens per minute and output tokens per minute for each model class. The limit works like a bucket that refills steadily, and going over it returns an HTTP 429 error, which means too many requests.
A sharp rise in traffic can cause 429 errors even when your average use is well under the limit. That is the launch-day problem: the average looks safe, and the peak does not.
So the model layer needs four guards. Put a per-user and per-team cap in your own code. Queue the work that can wait. Retry failed calls with exponential backoff and jitter, which means waiting longer each time and adding a random delay. Keep a second provider for when the first one throttles or fails.
Guarding the model layer
Launch-day spike
ten times normal traffic
Your own caps
per user and per team limits
Work queue
urgent first, batch work later
Model calls
Main provider
the normal route
Second provider
used when the first throttles
Answer or clear wait
the user always knows what happens
- 1The spike hits your own caps first.
- 2Requests inside the caps join the queue.
- 3Workers send jobs at the pace the provider allows.
- 4Overflow, or jobs the queue sends away from a throttled provider, go to the second.
- 5The main provider's answer reaches the user.
- 6The backup's answer reaches the user, or a clear delay message does.
“At Amazon we avoid overload by designing our systems to scale proactively, before they encounter overload situations.”
Amazon, on load shedding
“A retry can increase the load on the system being called, if the system is already failing because it's approaching an overload.”
Amazon, on timeouts and retries
“A sharp increase in usage can also cause 429 errors.”
Anthropic, on rate limits
Retries need the most care. A retry adds load to a system that is already struggling, and if every client retries at the same moment, the retries can be ineffective. Random jitter spreads them out, so the system gets room to recover.
Worked example. A claims assistant at a mid-size insurer hits its per-minute input limit at 9 a.m., when 3,000 claims arrive together. The fix is in code: claims wait in a queue, workers send them at the pace the provider allows, and each adjuster sees a waiting status instead of an error. Overnight summaries move to batch processing, which sends many requests together and lets the provider finish them later.
Tip
Don't promise the model answers every time. Say what happens at the limit: the job waits, moves to the backup, or the customer hears about the delay.
How would you handle a tenfold spike on launch day?
Plan before the day, not during it. Load test to find the real ceiling. Ask the provider for more capacity early, because a ramp limit caps how fast your organisation's token use on a model can grow. Check how often the cache answers without calling the model (the hit rate) in a test copy of the app.
- 1
Test before launch
Load test the full path, from the load balancer to the model, and find the first layer that fills up.
- 2
Raise the limits early
Ask the provider for more capacity before launch day, since a ramp limit caps how fast your token use can grow.
- 3
Shed what you can't serve
Turn away low-value work with a clear message, rather than let every request slow down together.
- 4
Watch four numbers
Requests a second, queue length, the 429 rate and cost per answer, with a rollback ready.
Shedding is the sharpest tool here. Amazon's engineers found that an overloaded computer keeps taking work, spends more of its time switching between tasks, and becomes too slow to be useful to anyone. That is why shedding, which means refusing some work early with a clear message, is worth planning for.
What does the interviewer want to hear?
A strong answer covers
- Layers: web, data and model, each with its own limit.
- Stateless servers behind a load balancer, with auto scaling.
- Caches and queues take repeat and background work off the hot path.
- The model is often the bottleneck: rate limits, 429s, retries with jitter.
- A fallback provider, a cost per answer and load tests before launch.
- Honest trade-offs: slightly old reads, shed requests, extra cost.
Common traps
Trap"Just add more servers."
BetterServers don't fix a shared database or a model's rate limit. Find which layer is full first.
Trap"We will use the biggest model."
BetterPick the smallest model that passes your tests for each task, and measure its quality and cost on your own data before you choose a bigger one.
Trap"The cloud scales for us automatically."
BetterAuto scaling adds web servers, not provider quota. The model limits are yours to plan for.
Can you spot the problem?
Spot the problem
A bank's chat assistant keeps each customer's conversation in the memory of the server that answers them. Which problem appears as traffic grows?
Quick check
Your AI app gets ten times normal traffic and starts returning 429 errors. What do you check first?
Can you answer these from memory?
Flash cards · tap a card to flip it
What will they ask next?
Last updated on 27 November 2026
Planning an AI product that must serve many users?
I design and build AI products and agents, including the interface and the system behind it. Book a short call and tell me your peak traffic, your launch date and what must stay up.