Interview Prep/Real-World Interview/Scaling and performance

API Gateway plus Lambda is throwing 429 and 502 errors under load. What's happening?

IntermediateScenarioScaling and performance
Answer

Situation read → 429s are throttling (API Gateway or Lambda concurrency); 502s are usually Lambda errors or timeouts surfacing through the gateway.

What I'd do →

  1. Check Lambda Throttles, ConcurrentExecutions, Errors and Duration in CloudWatch.
  2. If concurrency is maxed: the account limit (1,000 default per region) is shared by all functions. Request an increase, and set reserved concurrency so one function can't starve others.
  3. Check API Gateway stage and usage-plan throttling limits.
  4. For 502s: look for timeouts and malformed responses in Lambda logs (a proxy integration must return statusCode and body).
  5. Reduce duration: cold starts (provisioned concurrency), slow downstream calls, and DB connection storms (use RDS Proxy).

Why → Lambda concurrency is roughly RPS × duration; halving duration halves the concurrency you need.

Interview tip → Quote the formula concurrency = requests per second × average duration.

All Real-World Interview questions Roadmap: Interview readiness

More on Scaling and performance