load-balancer-placement1 Million Users. 1 Server. Crash.
You can't fit 1,000 people into a tiny restaurant, and you can't send 1,000,000 users to a single server. Let's learn how to distribute traffic using a Load Balancer.
Distributing the Load
Review these concept cards before jumping onto the visual practice canvas.
1. The Supermarket Analogy
Imagine a busy supermarket with 100 customers waiting in line, but there is only 1 cashier. The cashier gets overwhelmed and completely stops working. Now, imagine 4 cashiers and a manager standing at the front. The manager points the next customer to the shortest line. That manager is the Load Balancer.
2. See the Architecture: Single Server vs Multi-Server
Toggle between the two setups below. Watch how data flows through each architecture. In the single server setup, ALL traffic hits one server. In the multi-server setup, the Load Balancer splits traffic evenly.
3. Interactive Traffic Overload Simulator
Click the "Send Traffic" button rapidly to simulate users visiting your app. See what happens to the server when the Load Balancer is disabled vs enabled.
4. Deep Dive: Layer 4 (L4) vs Layer 7 (L7) Routing
Load balancers operate at different layers of the OSI Model. The choice between L4 and L7 changes performance, cost, and routing capabilities.
An L4 Load Balancer works purely with packet headers. It looks ONLY at the Source/Destination IP Address and TCP/UDP Port without opening or decrypting the actual data payload.
- Ultra-Fast: Millions of requests/sec with minimal CPU.
- Low Latency: No packet buffer overhead or TLS decryption.
- Protocol Agnostic: Works for TCP, UDP, gRPC, database connections, MQTT.
- No Content Routing: Cannot route based on URL path or HTTP headers.
- No Cookie Stickiness: Cannot read HTTP cookies for sticky sessions.
- No TLS Termination: Backend servers must handle SSL certificates.
| Feature | Layer 4 (NLB / TCP) | Layer 7 (ALB / HTTP) |
|---|---|---|
| OSI Layer | Layer 4 (Transport) | Layer 7 (Application) |
| Data Inspected | IP Address + Port only | HTTP Path, Headers, Cookies, Query Params |
| SSL/TLS Termination | Passed through to backend | Terminated at Load Balancer |
| Performance | Ultra-high throughput, ~0.1ms latency | High throughput, ~1-5ms latency |
| Smart Routing | ❌ None (round-robin / IP hash) | ✅ Path-based, Host-based, Header-based |
| Best For | High-volume TCP/UDP, gaming, streaming | Web apps, microservices, REST/GraphQL APIs |
Build Your Architecture
Place a Load Balancer to protect your backend servers from direct traffic.
Task: Load Balancer Placement
Drag components to arrange them freely, and click two nodes to connect them.
System Validation Criteria
Our automated rubric checks your design for these critical rules: