Scale from zero to millions of users
One system grown stage by stage, from a single server to sharded databases in two data centers: what breaks at each stage, the one part that fixes it, and what that part costs.
Overview
Almost every large system started as one program on one machine. It grew because something broke: the machine ran out of memory, a database was too slow, a data center lost power. Each time, the team added one part that removed that limit, and each part brought a new cost with it.
This chapter follows one made-up product, a recipe-sharing site called recipebox.example, from its first user to many millions. Each stage has one figure, and every figure is the same drawing with one new part added and marked "New". Read them in order and you watch one system grow. The other figures zoom in on one idea at a time: vertical against horizontal scaling, failover, a CDN miss, where sessions live, and how a shard key picks a shard.
The stages are not a fixed recipe. Real systems skip some, reorder others and stop once they are big enough. What matters in an interview is the reasoning: you can say which limit a system will hit next, and which part moves that limit, at what price.
What you will be able to do
- Draw the growth of a web system from one server to sharded databases in two data centers, one part at a time.
- Name the limit each stage removes and the next limit it runs into.
- Explain the cost of each new part: replication lag, stale cache entries, CDN invalidation, cross-shard queries.
- Tell scaling up from scaling out, and say when each is the right move.
- Use the same growth story to open the high-level design of any interview question.
Key concepts
- Single server
- Separate database tier
- Vertical and horizontal scaling
- Load balancer
- Read replicas and failover
- Cache
- CDN
- Stateless web tier
- Multiple data centers
- Message queue
- Logs, metrics and automation
- Sharding
Interview questions
- Walk me through how you would scale a web application from one server to millions of users.
- Why is a stateless web tier so important?
- When would you scale up instead of scaling out?
- What problems do read replicas introduce?
- How does a CDN work, and what can go wrong with it?
- What are the hardest parts of running in more than one data center?
- When should a system add a message queue?
- How do you choose a shard key?
- What does sharding cost?
- What would you monitor in a system at this scale?
Sign up free to read the full topic
More System Design topics
- Redundancy and Replication
- REST vs RPC vs GraphQL
- Retail Platform: Five Nines Across Stores and Clouds
- Returns and Refund Management System
- RPO & RTO
- Saga Pattern for Distributed Transactions
- Scaling Reads
- Scaling Writes
- Search Ranking System
- Search System Design
- Security
- Security Platform for a Hybrid, Multi-Cloud Fleet
Start free on Cariara · Coding problems · System design studio