Meet the building blocks: a map of a typical web system
Most large web systems are built from the same dozen parts — clients, DNS, a CDN, load balancers, app servers, caches, databases, queues, workers and object storage — connected in a familiar shape.
Must-know points
- Client: the app or browser the user holds.
- DNS: turns a name (example.com) into a server's address.
- CDN: servers around the world that keep copies of files close to users.
- Load balancer: spreads requests across many servers and skips broken ones.
- App server: runs your code; usually stateless, so you can add more.
- Cache: fast memory holding copies of often-read data (often Redis).
- Database: the permanent, trusted store of your data.
- Queue and workers: a waiting line of jobs, and the background programs that do them.
- Object storage: cheap, huge storage for files like photos and videos (for example Amazon S3).
Common mistakes
- Learning tool names (Redis, Kafka) before knowing what job each box does.
- Thinking every system needs every box. A small app may only need one server and one database.
- Treating the cache as the place where data really lives. The database is the source of truth.
Interview answer
Most designs start from the same shape. Clients reach us through DNS; files come from a CDN; a load balancer spreads requests across stateless app servers; those servers read from a cache and a database, push slow work onto a queue for workers, and keep large files in object storage. Then I scale whichever box the requirements stress most.
Follow-up questions
Which box is usually the hardest to scale?
The database, because it holds data that must stay correct. App servers are easy to copy; data is not.
Why put a queue between the app server and the workers?
So the user doesn't wait for slow work, and so a burst of jobs waits in line instead of overloading the workers.