One server cannot carry millions of users. This lesson shows the exact order of moves that takes a single box to a resilient, multi-tier system.
Outcomes
How to read: Follow arrows left to right: users hit the load balancer, which routes to web servers, which write to the master and read from slaves.
User gets the load balancer IP from DNS.
User connects to the load balancer with that IP.
HTTP request is routed to Server 1 or Server 2.
Web server reads user data from a slave database.
Web server routes write, update, and delete operations to the master database.
How to read: Watch the dots: each one is a request. The balancer alternates servers, so consecutive dots take different branches.
Your request arrives at the balancer, the single public entry point.
The balancer picks the next server in rotation: Server 1, then Server 2.
If a server stops responding, it leaves the rotation until healthy.
How to read: Follow arrows left to right: the web server asks the cache first, and only on a miss does it query the database and write the result back.