1
votes

I have an Azure web app service with enabled Health-check feature and the following auto-scale configuration:

{
    "name": "Auto created scale condition",
    "capacity": {
        "minimum": 2,
        "maximum": 10,
        "default": 2
    },
    "rules": [
        {
            "metricTrigger": {
                "metricName": "CpuPercentage",
                "metricNamespace": "",
                "metricResourceUri": "[resourceId('Microsoft.Web/serverfarms', parameters('ServicePlanName'))]",
                "timeGrain": "PT1M",
                "statistic": "Average",
                "timeWindow": "PT10M",
                "timeAggregation": "Average",
                "operator": "GreaterThan",
                "threshold": 70
            },
            "scaleAction": {
                "direction": "Increase",
                "type": "ChangeCount",
                "value": "1",
                "cooldown": "PT5M"
            }
        }
    ]
}

The question: Does Azure count unhealthy instances for CPU loading while scaling up and down? I don't see this in official documentation and also I did some tests making one instance unhealthy but have got some unclear results.

So, let's imagine an unhealthy instance has 0% CPU usage and the healthy one has 90% CPU. So, totally on average we have (0%+90%)/2=45%. Will scale-out rule work in this case?

Thanks

1

1 Answers

1
votes

The scale out logic does not look at whether your instances are healthy. Likewise, if an instance becomes unhealthy because of something like a dead lock in your code and causes the instance to reach 100% CPU usage, your scale out logic would trigger adding an additional instance, even though the increased CPU usage isn't being triggered by additional users.

To mitigate unhealthy instances quickly and automatically until you are able to resolve the issue within your code, we typically recommend customers turn on auto-heal and set it to restart the site process based on the parameters that you feel are occurring such as http errors. For more information on auto-heal, please see here.