title | description | services | documentationcenter | author | manager | editor | ms.service | ms.workload | ms.topic | ms.date | ms.author |
---|---|---|---|---|---|---|---|---|---|---|---|
Configure autoscale of an Azure API Management instance | Microsoft Docs |
This topic describes how to set up autoscale behavior for an Azure API Management instance. |
api-management |
mikebudzynski |
anneta |
api-management |
integration |
article |
06/20/2018 |
apimpm |
Azure API Management service instance can scale automatically based on a set of rules. This behavior can be enabled and configured through Azure Monitor and is supported only in Standard and Premium tiers of the Azure API Management service.
The article walks through the process of configuring autoscale and suggests optimal configuration of autoscale rules.
To follow the steps from this article, you must:
- Have an active Azure subscription.
- Have an Azure API Management instance. For more information, see Create an Azure API Management instance.
- Understand the concept of Capacity of an Azure API Management instance.
- Understand manual scaling process of an Azure API Management instance, including cost consequences.
Certain limitations and consequences of scaling decisions need to be considered before configuring autoscale behavior.
- Autoscale can be enabled only for Standard and Premium tiers of Azure API Management service.
- Pricing tiers also specify the maximum number of units for a service instance.
- Scaling process will take at least 20 minutes.
- If the service is locked by another operation, scaling request will fail and retry automatically.
- In case of a service with multi-regional deployments, only units in the Primary location can be scaled. Units in other locations can't be scaled.
Follow the steps below to configure autoscale for an Azure API Management service:
-
Navigate to Monitor instance in the Azure portal.
-
Select Autoscale from the menu on the left.
-
Locate your Azure API Management service based on the filters in dropdown menus.
-
Select the desired Azure API Management service instance.
-
In the newly opened section, click the Enable autoscale button.
-
In the Rules section, click + Add a rule.
-
Define a new scale out rule.
For example, a scale out rule could trigger an addition of an Azure API Management unit, when the average capacity metric over the last 30 minutes exceeds 80%. The table below provides configuration for such a rule.
Parameter Value Notes Metric source Current resource Define the rule based on the current Azure API Management resource metrics. Criteria Time aggregation Average Metric name Capacity Capacity metric is an Azure API Management metric reflecting usage of resources of an Azure API Management instance. Time grain statistic Average Operator Greater than Threshold 80% The threshold for the averaged capacity metric. Duration (in minutes) 30 The timespan to average the capacity metric over is specific to usage patterns. The longer the time period is, the smoother the reaction will be - intermittent spikes will have less effect on the scale-out decision. However, it will also delay the scale-out trigger. Action Operation Increase count by Instance count 1 Scale out the Azure API Management instance by 1 unit. Cool down (minutes) 60 It takes at least 20 minutes for the Azure API Management service to scale out. In most cases, the cool down period of 60 minutes prevents from triggering many scale-outs. -
Click Add to save the rule.
-
Click again on + Add a rule.
This time, a scale in rule needs to be defined. It will ensure resources are not being wasted, when the usage of APIs decreases.
-
Define a new scale in rule.
For example, a scale in rule could trigger a removal of an Azure API Management unit, when the average capacity metric over the last 30 minutes has been lower than 35%. The table below provides configuration for such a rule.
Parameter Value Notes Metric source Current resource Define the rule based on the current Azure API Management resource metrics. Criteria Time aggregation Average Metric name Capacity Same metric as the one used for the scale out rule. Time grain statistic Average Operator Less than Threshold 35% Similarly to the scale out rule, this value heavily depends on the usage patterns of the Azure API Management. Duration (in minutes) 30 Same value as the one used for the scale out rule. Action Operation Decrease count by Opposite to what was used for the scale out rule. Instance count 1 Same value as the one used for the scale out rule. Cool down (minutes) 90 Scale in should be more conservative than a scale out, so the cool down period should be longer. -
Click Add to save the rule.
-
Set the maximum number of Azure API Management units.
[!NOTE] Azure API Management has a limit of units an instance can scale out to. The limit depends on a service tier.
-
Click Save. Your autoscale has been configured.