SteelReed

Search

Search posts, questions…

System DesignQuestion 8 / 26

Middle

How does an API gateway differ from a load balancer, and how do they work together?

Short answer

A load balancer handles load distribution: which healthy instance gets this request. An API gateway handles API management: who may call, how often, and which service to route to. The two are complementary, not substitutes.

spreads loadauth, rate limit, routeClientLoad balancerAPI gateway clusterLB / service discoveryTarget service instance

3 points to say:

  1. LB (L4 or L7): health checks, balancing algorithm, TLS; no business knowledge, it only answers "which instance?".
  2. Gateway (L7): authentication, per-client rate limits, API routing, transformation, response aggregation.
  3. Usually LB in front, gateway behind; the gateway still needs an LB/discovery to pick instances. Small systems: one reverse proxy can be enough.

Keep reading the deep dive

Create a free account to read the full explanation and follow-up questions, mark questions as studied and review them on a schedule.