Performance efficiency pillar in Azure - Time & Space Complexity
We want to understand how the time to perform cloud operations changes as we increase workload or resources.
How does the system handle more work without slowing down too much?
Analyze the time complexity of scaling a virtual machine scale set in Azure.
// Create a VM scale set with initial instances
az vmss create --name MyScaleSet --resource-group MyGroup --image UbuntuLTS --instance-count 2
// Increase the number of instances
az vmss scale --name MyScaleSet --resource-group MyGroup --new-capacity 10
// Monitor the scaling operation
az vmss list-instances --name MyScaleSet --resource-group MyGroup
This sequence creates a group of virtual machines, then scales up the number of machines, and checks their status.
Look at what happens multiple times during scaling.
- Primary operation: Provisioning each new virtual machine instance.
- How many times: Equal to the number of new instances added (e.g., 8 more machines when scaling from 2 to 10).
Adding more machines means more provisioning steps, each taking time.
| Input Size (n) | Approx. API Calls/Operations |
|---|---|
| 10 | 10 provisioning calls |
| 100 | 100 provisioning calls |
| 1000 | 1000 provisioning calls |
Pattern observation: The time grows directly with the number of instances added.
Time Complexity: O(n)
This means the time to scale grows linearly with the number of virtual machines you add.
[X] Wrong: "Scaling up many machines happens instantly regardless of count."
[OK] Correct: Each machine needs time and resources to start, so more machines mean more total time.
Understanding how scaling time grows helps you design systems that stay fast as they grow, a key skill in cloud work.
"What if we used containers instead of virtual machines for scaling? How would the time complexity change?"