Plan a server city: 10 levels of load balancers, cache, CDN and database sharding. An intro system design game for interview prep.
Welcome, Server Mayor. Your job is to build the right infrastructure for every scenario. Pick only the components that are needed: don't over-engineer (too much) or under-engineer (too little).
A Load Balancer spreads requests across several servers. Common algorithms: Round Robin (take turns), Least Connections (to the idlest one), or IP Hash (a user always lands on the same server).
Caching stores the result of a computation/query so it doesn't have to be redone. Redis = in-memory key-value store, ~1ms latency. Cache hit = take it from Redis. Cache miss = query the DB, then store it in Redis.
A Message Queue separates request handling from background processing. Example: the user checks out → "Order received!" (instantly) → the email, invoice and inventory are processed in the background by a worker.
And more, 16 levels in all.