Hi @ares
Thanks for the question and using MS Q&A platform.
Scaling up rules looks mostly correct so let's optimize it for Good:
Metric: CPU Percentage, Operator: Greater than, Threshold: 30%, Duration: 1 minute (This is good for quick response), Grain: 1 minute, cool down: 1 minute, Operation: Increase count by, Instance count: 1
You will need to add a second rule for scaling down:
Metric: CPU Percentage, Operator: Less than, Threshold: 30%, Duration: 10 – 15 minutes (To avoid flapping), Grain: 1 minute, cool down: 5 minutes, Operation: decrease count by, Instance count: 1
Important additional settings:
In the instance limit section (not visible in the image), ensure to set: Min 1 Max 2 Default 1
Yes, you do need to add a separate rule for scaling down. The current configuration only handles scaling up. Without a scale-down rule, the service will stay at the higher instance count indefinitely.
The scale down rule is designed to allow for a longer period before cooling down to reduce the chances of the system scaling down too fast due to brief spikes on the CPU. This avoids the situation where you are constantly scaling up and down, a phenomenon commonly referred to as flapping.
references:
https://learn.microsoft.com/en-us/azure/app-service/manage-automatic-scaling?utm_source=chatgpt.com&tabs=azure-portal
https://learn.microsoft.com/en-us/azure/azure-monitor/autoscale/autoscale-get-started?utm_source=chatgpt.com
Please accept as "Yes" if the answer provided is useful, so that you can help others in the community looking for remediation for similar issues.