Why API Gateway matters in AWS - Performance Analysis
We want to understand how the work done by API Gateway grows as more requests come in.
How does the number of API calls affect the time it takes to handle requests?
Analyze the time complexity of handling multiple API requests through API Gateway.
// Pseudocode for API Gateway handling requests
for each request in incomingRequests:
validate request
route to backend service
apply throttling and caching
send response
This sequence shows how API Gateway processes each incoming request step-by-step.
Look at what happens repeatedly for each request.
- Primary operation: Processing each API request through validation, routing, and response.
- How many times: Once per incoming request.
Each new request adds one more set of processing steps.
| Input Size (n) | Approx. Api Calls/Operations |
|---|---|
| 10 | 10 processing steps |
| 100 | 100 processing steps |
| 1000 | 1000 processing steps |
Pattern observation: The work grows directly with the number of requests.
Time Complexity: O(n)
This means the time to handle requests grows in a straight line as more requests come in.
[X] Wrong: "API Gateway processes all requests at once, so time stays the same no matter how many requests arrive."
[OK] Correct: Each request needs its own processing steps, so more requests mean more work and more time.
Understanding how API Gateway scales with requests helps you design systems that handle traffic smoothly and predict performance.
"What if API Gateway used caching to reduce processing for repeated requests? How would the time complexity change?"