Application Load Balancer (ALB) in AWS - Time & Space Complexity
We want to understand how the work done by an Application Load Balancer changes as more requests come in.
Specifically, how does the number of requests affect the number of operations the ALB performs?
Analyze the time complexity of this ALB request routing process.
// Pseudocode for ALB handling requests
for each incoming request {
check listener rules
select target group
forward request to target
}
This sequence shows how the ALB processes each incoming request by checking rules and forwarding it.
Look at what happens repeatedly as requests come in.
- Primary operation: Processing each incoming request (checking rules and forwarding)
- How many times: Once per request
As the number of requests grows, the ALB processes each one individually.
| Input Size (n) | Approx. Api Calls/Operations |
|---|---|
| 10 | 10 request processings |
| 100 | 100 request processings |
| 1000 | 1000 request processings |
Pattern observation: The work grows directly with the number of requests.
Time Complexity: O(n)
This means the ALB’s work increases in a straight line as more requests arrive.
[X] Wrong: "The ALB processes all requests at once, so the time doesn’t increase with more requests."
[OK] Correct: Each request is handled separately, so more requests mean more processing steps.
Understanding how load balancers handle requests helps you explain system behavior clearly and shows you grasp real cloud workloads.
"What if the ALB had to check multiple complex rules for each request? How would the time complexity change?"