Three jobs share one entrance: spread, shape, and govern.
At the front door of a system, which job is about spreading traffic, and which job is about enforcing policy?
Before reading, decide whether a load balancer, reverse proxy, and API gateway are the same thing or different jobs.
This boundary shows up later in upload systems, APIs, chat gateways, and rate limiting.
A candidate draws a system. The interviewer points at the line between the user and the app servers and asks: "What's that box?" The candidate says "load balancer." The interviewer asks "why?" — and the candidate stalls.
That stall is what this chapter exists to prevent. The vocabulary at the edge — load balancer, reverse proxy, API gateway — is a trap if you treat it as three unrelated boxes. They're three jobs, often performed by overlapping tools, and they can be explained by what each one decides.
The three jobs exist because they answer three different questions, and each gets harder as the system grows.
If a request can run on any healthy server, distributing them gets you both throughput and failover for free. Health checks are non-negotiable — a failed server should disappear from rotation in seconds.
TLS termination, path routing, header rewriting, response compression, edge caching. Each is something you'd rather do once at the edge than re-implement in every service.
Auth, rate limits, quotas, tenant rules, API versioning. These are the things you'd hate to ship in 12 different services with subtle differences.
The interviewer isn't grading your vocabulary. They're listening for whether you can name the job before the component.
The "shape" job earns its keep when the URL itself tells the edge where the request belongs. This is the most common way candidates encounter reverse proxies in real systems.
Load balancer, reverse proxy, and gateway are interchangeable labels.
They can sit near the same place, but they answer different questions: where should traffic go, how should it be shaped, and what rules must be enforced?
Name the job first, then choose the front-door component that performs that job.
| Edge choice | Good when | Weak when | Interview line |
|---|---|---|---|
| Direct to one app server | System is tiny and early-stage. | Creates a clear single-server bottleneck and weak availability. | Acceptable for the smallest version, but it doesn't scale or fail over well. |
| Load balancer Default | You have multiple app instances and need traffic spread plus health-based routing. | It doesn't by itself solve API policy or complex request routing. | I want a load balancer here so requests are spread across healthy stateless servers. |
| Reverse proxy | You need path-based routing, TLS termination, caching, compression, or shielding internal services. | Adds edge complexity if the system doesn't need those controls yet. | A reverse proxy helps me control how requests enter and which internal service they reach. |
| API gateway | You need centralized auth, quotas, tenant policy, versioning, or API-specific controls. | Overkill for a simple internal system or a single basic endpoint. | I'd use a gateway when API policy is important enough to centralize instead of reimplementing in each service. |
Prompt: "Design a URL shortener." (We'll keep coming back to this. Spaced repetition is doing the work.)
Do not jump straight from reading to a full answer. First see the shape, then complete part of it, then answer alone.
I would say: "For profile photo uploads, the gateway can authenticate and limit requests while the load balancer spreads accepted traffic."
Separate the upload path from the view path and decide which front-door job each path needs.
For the practice prompt, draw only the client, front door, app service, and storage. Label the front-door job.
Before moving on, turn recognition into production. Close the model answer, answer from memory, then retry one small slice.
Say the chapter's core idea without looking. Then name one related idea from an earlier chapter.
Change one constraint in the practice prompt and answer again in half the time.
Use the rubric to pick one dimension below 3, then retry only that dimension.
"Spread / Shape / Govern" is the brain's hook before the vocabulary.
Don't argue brands. Argue responsibilities.
Each capability adds a hop, a failure mode, and an operations bill.