API
Gateways
The entry point for all client requests. An intelligent layer that acts as the protector and navigator of your microservices.
What is a Gateway?
Think of it as a Reverse Proxy on Steroids. While NGINX is great at L4/L7 routing, an API Gateway handles advanced application concerns like authentication, rate-limiting, and protocol translation.
Core Responsibilities
Dynamic Routing
Maps /v1/users to the User microservice.
Auth Termination
Validates JWTs so your app servers don't have to.
Transformation
Converts XML to JSON or gRPC-Web to internal gRPC.
Resilience
Circuit breaking for failing downstream services.
Aggregation
One request from mobile = 5 internal requests.
Logging/Metric
Entry-point observability for all traffic.
3. Circuit Breaking
If a downstream service starts failing or timing out, the Gateway can "Trip the Circuit" and return a fast-fail response (503) immediately instead of letting the failure propagate.
The Toolset
Cloud Native
- ★ Envoy Proxy: Ultra-fast, the gold standard for CNCF.
- ★ Kong: Built on NGINX, very popular for enterprise.
Managed Services
- ★ AWS API Gateway: High cost, but scales to infinity.
- ★ Cloudflare Workers: Serverless edge compute.
Interview Guidance
"Why not use a Load Balancer?"
A standard Load Balancer (ELB) just moves packets. A Gateway knows your business rules (Auth, Rate Limits per User ID).
Mentioning Bottlenecks
"Single Point of Failure" Risk.
Explain that you'd run multiple instances of the Gateway behind an L4 Load Balancer to avoid the Gateway becoming a single failure point.