Overview

An API gateway sits at the edge of your system, managing traffic between external clients and your services. A service mesh operates inside the cluster, managing traffic between services themselves. Confusing the two leads teams to either duplicate cross-cutting concerns or push edge-only features into infrastructure that was never designed for public-facing traffic.

Comparison Diagram

API GatewayService MeshClientAPI GatewayauthN · rate limitrouting · transformclusterService AService BService Csidecar proxymTLS · retriesnorth–south: client-to-serviceeast–west: service-to-service

Comparison Table

AspectAPI GatewayService Mesh
Traffic directionNorth-south: external clients entering the systemEast-west: internal service-to-service calls
Deployment topologyCentralized cluster of edge instances fronting all trafficSidecar proxy injected alongside every service instance
Primary concernsAuthN/authZ, rate limiting, request/response transformation, API versioningmTLS, load balancing, retries, circuit breaking between services
Routing basisPublic API path, host, or version mapped to a backend serviceService identity and destination within the internal network
Observability scopePer-endpoint metrics: request volume, latency, errors by clientFull service dependency graph: per-hop latency and error rates
Failure containmentBlocks or throttles bad traffic before it reaches any backendIsolates failures at individual hops so one bad service doesn’t cascade
Operational overheadFew instances to scale and configure centrallyOne proxy per workload, plus a control plane to manage them all

Key Differences

  • An API gateway is the single entry point clients hit; a service mesh has no single entry point, it’s woven through every service.
  • Gateways enforce policy once at the edge; meshes enforce policy per sidecar on every call.
  • Gateways typically run as a small number of centralized instances; meshes scale linearly with your service count.
  • Meshes give you mTLS and retries between internal services, something a gateway never sees because that traffic never reaches it.
  • Many production systems run both together, not as alternatives, since they solve problems at different layers.

When to Use Each

API Gateway

  • Public API management: You need a single point to apply auth, rate limiting, and versioning for external consumers.
  • Protocol translation at the edge: Clients speak REST or GraphQL but internal services use gRPC, so translation belongs at the boundary.
  • Simple microservice setups: With only a handful of services, a gateway alone can handle routing without the overhead of a full mesh.

Service Mesh

  • Zero-trust internal networking: You need automatic mTLS and identity verification between every service without changing application code.
  • Large microservice fleets: Dozens or hundreds of services need consistent retries, timeouts, and circuit breaking without per-service implementation.
  • Fine-grained traffic control: You want canary rollouts or traffic shifting between service versions at the network layer.