How to Scale a Web App From 1 to 1 Million Users
No app is designed for a million users on day one, and it shouldn’t be. Big systems grow one bottleneck at a time: something gets slow, you find out what, and you add the one part that fixes it. Here is the order that happens in for most web apps, and why each part exists.
System design · 2026-11-25 · 8 min read
The rule: find the bottleneck first
Before adding anything, look at what is actually overloaded: CPU on the app servers, queries on the database, bandwidth for files, or a slow outside service. Adding the wrong part costs money and fixes nothing. Each stage below starts with the symptom that tells you it is time.
Stage 1: one server (1 to ~1,000 users)
The app and its database run on one machine. That is the right start: simple, cheap and easy to change. The symptom that ends it: CPU and memory are maxed out because the app and the database compete for the same machine.
Fix: move the database to its own server. Each part gets a whole machine, and from now on you can grow them separately.
Stage 2: more app servers (~10,000 users)
Next, one app server can’t keep up, and every restart or deploy takes the site down. Buying a bigger machine (vertical scaling) works for a while, but it has a ceiling and is still one point of failure.
Fix: put several app servers behind a load balancer (horizontal scaling). The load balancer spreads requests and stops sending traffic to a server that dies. For this to work, servers must be stateless: keep sessions and uploads in a shared store, not on the server’s own disk.
Stage 3: a cache (~100,000 users)
Now the app servers are fine but the database is drowning, usually in the same reads over and over: the home page, popular products, user profiles.
Fix: add a cache like Redis in front of the database. The app checks the cache first and only reads the database on a miss (the cache-aside pattern). It is common to see 90% of reads served from memory. The trade-off is freshness: cached data can be slightly old, so set an expiry (TTL) and delete cached items when their data changes.
Lesson: caching strategies, step by step →
Stage 4: read replicas (~300,000 users)
As users read more varied things, more reads miss the cache and land on the database again. Reads usually outnumber writes 10 to 1 or more.
Fix: add read replicas. All writes go to the primary database, which streams every change to read-only copies that share the reads. Replicas can be a moment behind, so read a user’s own fresh changes from the primary.
Stage 5: a CDN (~1,000,000 users, worldwide)
With users around the world, images, video and scripts are slow far from your servers, and sending the same files keeps your servers busy.
Fix: serve static files through a CDN. Servers in many cities keep copies close to users, so files load in milliseconds and your own servers only do real work.
| Symptom | Fix | Trade-off |
|---|---|---|
| App and database fight for one machine | Separate the database | Two machines to run |
| One app server is maxed out | Load balancer + more servers | Servers must be stateless |
| Same reads over and over | Cache (Redis) | Data can be slightly stale |
| Many varied reads | Read replicas | Replicas lag a little |
| Slow files far from servers | CDN | Cached files need refreshing |
Beyond a million: queues and sharding
Two more parts show up as apps keep growing. Message queues move slow work (emails, image processing, partner calls) out of the request, so users never wait for it. Sharding splits the data across several databases when one primary can’t handle the writes or hold the data, with a shard key such as a hash of the user ID deciding where each row lives.
Lesson: message queues, step by step →
Lesson: sharding and replication →
Learn it by breaking it
Reading the list is one thing; choosing the fix when the system is on fire is another. In the interactive lesson you grow an app from one server to a million users: each time it breaks, you pick a fix and watch what it does, including the fixes that only help for a while.
Tip: The same order is what interviewers expect in a system design interview: start simple, name the bottleneck, add one part, and say what it costs.
Play: from 1 user to 1 million →
Frequently asked questions
What should I scale first when my app gets slow?
Measure first. Usually the order is: put the database on its own server, add app servers behind a load balancer, add a cache, then read replicas and a CDN. Fix the part that is actually overloaded.
What is the difference between vertical and horizontal scaling?
Vertical scaling means a bigger machine: simple, but limited and still a single point of failure. Horizontal scaling means more machines behind a load balancer: it keeps growing and survives a machine failing.
Do I need microservices to reach a million users?
No. Many apps serve millions from a well-built monolith with a cache, replicas and a CDN. Microservices mainly help large teams release independently.
When should I shard my database?
Late: when one primary can’t handle the writes or store the data even after caching, replicas and a bigger machine. Sharding adds real complexity to queries and operations.