Why auto scaling matters in AWS - Performance Analysis
We want to understand how the work needed to handle growing traffic changes when using auto scaling.
How does the number of servers and their management grow as demand increases?
Analyze the time complexity of the following operation sequence.
# AWS Auto Scaling example
aws autoscaling create-auto-scaling-group --auto-scaling-group-name my-asg \
--launch-configuration-name my-launch-config --min-size 1 --max-size 10 \
--desired-capacity 1 --vpc-zone-identifier subnet-12345
aws autoscaling put-scaling-policy --auto-scaling-group-name my-asg \
--policy-name scale-out --scaling-adjustment 1 --adjustment-type ChangeInCapacity
# When CPU > 70%, scale out by 1 instance
# When CPU < 30%, scale in by 1 instance
This sequence sets up an auto scaling group that adds or removes servers based on CPU load.
- Primary operation: Launching or terminating EC2 instances as load changes.
- How many times: Depends on how often load crosses thresholds, up to max-size times.
As demand (load) grows, the number of instances increases one by one until the max limit.
| Input Size (Load Level) | Approx. Instances Running |
|---|---|
| Low (10%) | 1 (minimum) |
| Medium (50%) | 5 (half max) |
| High (90%) | 10 (max) |
Pattern observation: The number of instances grows roughly linearly with demand until the max limit.
Time Complexity: O(n)
This means the number of servers and scaling actions grows linearly as demand increases.
[X] Wrong: "Auto scaling instantly adds all needed servers at once regardless of demand."
[OK] Correct: Auto scaling adds or removes servers step-by-step based on policies and thresholds, not all at once.
Understanding how auto scaling grows with demand shows you can design systems that handle traffic smoothly and efficiently.
"What if the auto scaling group had no max size limit? How would the time complexity change?"