KatInterview

Building a Fault-Tolerant HTTP Traffic Distribution Layer

System DesignModel answer
HardModel answerSystem Designload-balancinghigh-availabilitylayer-7

Last updated

Design a resilient, horizontally scalable HTTP/HTTPS traffic distribution tier that routes by path or header, tracks backend health, and survives node and control-plane failures without dropping connections.

Scenario

Your platform runs a large fleet of microservices behind a single public entry point. You are asked to design the application-layer (L7) traffic distribution tier that accepts HTTP/HTTPS requests and forwards them to the right backend instance. The tier must sustain millions of requests per second and must keep serving through hardware, zone, and software failures.

What the system must do

Functional

  • Route requests by URL path, host, or header values (for example, sending requests with a version header to a specific service version).
  • Offer standard selection strategies such as round robin and least connections.

Non-functional

  • High availability with no single point of failure.
  • Horizontal scalability.
  • Very small added latency per request.

Constraint

  • Backend instances start and stop frequently. Doing so must not cut off connections that are already active.

What to cover in your answer

  1. Architecture. How clients find and reach the system (DNS, Anycast, or similar) and how traffic flows to the backends.
  2. Health tracking. How backend health is detected and how each node keeps a current view of the available pool.
  3. Failure behavior. What happens when one of your traffic nodes dies, and how the configuration/control side stays operational.
  4. Scaling. How you grow the tier itself as load increases.

Also address

  • How you would support session persistence (sticky sessions).
  • How you avoid a thundering herd when a failed backend comes back.
  • When you would terminate TLS at the tier versus pass encrypted traffic through untouched.

State your assumptions about scale and do a rough capacity estimate.

Hints

Hint 1

Separate the per-request data path from the configuration path. Ask what should keep working if the configuration system goes completely offline.

Hint 2

Consider splitting the tier in two: a cheap, near-stateless packet-steering layer in front of a feature-rich HTTP layer. Think about what hashing scheme lets the front layer lose a node without breaking existing connections.

Hint 3

For safe scale-down, think in terms of endpoint states (warming, healthy, draining, unhealthy) and a drain sequence. For recovery storms, think about gradually ramping weight rather than flipping a backend instantly to full share.