0
0
Azurecloud~10 mins

Auto scaling App Service in Azure - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Auto scaling App Service
Start: App Service Running
Monitor Metrics: CPU, Requests
Check Thresholds
Scale Out
Add Instances
Update App Service Instances
Continue Monitoring
The App Service monitors its performance metrics. If usage is high, it adds instances (scale out). If usage is low, it removes instances (scale in). This cycle repeats to keep the app responsive.
Execution Sample
Azure
Monitor CPU > 70%?
  Yes -> Increase instances by 1
Monitor CPU < 30%?
  Yes -> Decrease instances by 1
Else -> No change
This logic checks CPU usage and adjusts the number of App Service instances accordingly.
Process Table
StepCPU Usage (%)Condition CheckedAction TakenInstances Count
165CPU > 70%? NoNo change2
275CPU > 70%? YesScale Out +13
380CPU > 70%? YesScale Out +14
450CPU < 30%? NoNo change4
525CPU < 30%? YesScale In -13
620CPU < 30%? YesScale In -12
735CPU < 30%? NoNo change2
872CPU > 70%? YesScale Out +13
968CPU > 70%? NoNo change3
1028CPU < 30%? YesScale In -12
💡 Execution stops after 10 steps of monitoring and scaling decisions.
Status Tracker
VariableStartAfter 1After 2After 3After 4After 5After 6After 7After 8After 9After 10
CPU Usage (%)65758050252035726828N/A
Instances Count22344322332
Key Moments - 3 Insights
Why does the number of instances not change when CPU usage is 65%?
Because the condition to scale out requires CPU usage to be greater than 70%, which is false at 65% (see step 1 in execution_table). So no scaling action is taken.
Why do we scale in when CPU usage is 25% but not when it is 35%?
Scaling in happens only if CPU usage is less than 30%. At 25% (step 5), this is true, so instances decrease. At 35% (step 7), the condition is false, so no change occurs.
Can the instances count go below 1 during scaling in?
No, best practice is to keep at least one instance running to avoid downtime. The example keeps instances at minimum 2, never scaling below that.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table at step 3. What is the instances count after scaling?
A2
B3
C4
D5
💡 Hint
Check the 'Instances Count' column at step 3 in execution_table.
At which step does the CPU usage first trigger a scale in action?
AStep 5
BStep 4
CStep 6
DStep 7
💡 Hint
Look for the first 'Scale In' action in the 'Action Taken' column in execution_table.
If the CPU threshold for scaling out changed from 70% to 60%, what would happen at step 1?
ANo change, instances remain 2
BScale Out, instances increase to 3
CScale In, instances decrease to 1
DError in scaling
💡 Hint
Compare CPU usage at step 1 with new threshold and check scaling condition in execution_table.
Concept Snapshot
Auto scaling App Service:
- Monitors app metrics like CPU usage.
- Scales out (adds instances) if usage > threshold.
- Scales in (removes instances) if usage < threshold.
- Keeps minimum instances to avoid downtime.
- Continuously adjusts to keep app responsive.
Full Transcript
Auto scaling in Azure App Service means the system watches how busy your app is, like checking CPU usage. If the app gets busy (CPU over 70%), it adds more instances to handle the load. If the app is not busy (CPU under 30%), it removes instances to save resources. This process repeats continuously to keep your app running smoothly without manual intervention. The example shows CPU usage changing over time and how the number of instances adjusts accordingly, never going below a safe minimum.