# Load balancing — one-pager

BayLearn · System Design Interview Sprint

**Today’s idea:** A traffic director sends each request to a free, healthy server copy. A gateway only checks front-door rules. Don’t store the user’s session in either box.

| Word | Plain meaning |
|------|----------------|
| Traffic director | Load balancer — next free helper |
| Helper | One server copy |
| Pair | Two traffic directors, not one box |
| L4 / L7 | Cannot read URL details / can read the path |
| Healthy | Helper can still do the real job (DB up) |
| Sticky | Always the same helper (fragile if down) |
| Front-door rules | Gateway: login, rate limits, size — not the money ledger |
| 429 vs 503 | Please wait vs nobody can help |
| Three timers | Database, then app, then client. Inside one first |
| Retry | Retry a simple read once. Don’t retry a payment |
| Drain | Wait 30–60s, then take the copy out |
| Fail closed | If every copy is sick → 503 |
| Spare copy | Plan so one copy can be down |

Copies ≈ peak ÷ what one copy can handle. Linkly: 40,000 / 2,000 = **20**. If 19 at about 2,100 is too much, use **21**. A new copy needs a few minutes. A cache buys time.

**What to say:** I picked this because of this number (or this rule). What I give up is this.

## Six rows

| Product | Copies | Health | Sticky? | Front door | Don’t do this |
|---------|--------|--------|---------|------------|----------------|
| Linkly | 20 at 40k/s | Key store up | No | 429 on create | Session in one copy |
| PulseFeed | Many readers | Feed path | No on Home | 429 on publish | Load balancer as photo CDN |
| RideHail | Pings ≠ trips | Per path | Long calls: say it | Login on trip | One pool for both |
| PayRail | Fewer, 1,200/s | Ledger up | No | Retry key + 60/min | Traffic director retries payment |
| ClinicDocs | Small API | API only | No | Upload ticket | PDF through JSON |
| TicketDrop | Many polls | Status ≠ seat | No cart in memory | 1 poll / 2s | Load balancer as the 10:00 fix |

DNS found the address. This traffic director picks the server copy. Run two.

Use this as a practice card while you speak out loud.
