|
1 | 1 | ---
|
2 |
| -title: Capacity of an Azure API Management instance | Microsoft Docs |
3 |
| -description: This article explains what the capacity metric is and how to make informed decisions whether to scale an Azure API Management instance. |
| 2 | +title: Capacity metrics - Azure API Management | Microsoft Docs |
| 3 | +description: This article explains the capacity metrics in Azure API Management and how to make informed decisions about whether to scale an instance. |
4 | 4 | services: api-management
|
5 | 5 | author: dlepow
|
6 | 6 |
|
7 | 7 | ms.service: azure-api-management
|
8 | 8 | ms.topic: how-to
|
9 |
| -ms.date: 07/06/2022 |
| 9 | +ms.date: 08/26/2024 |
10 | 10 | ms.author: danlep
|
11 | 11 | ms.custom: fasttrack-edit
|
12 | 12 | ---
|
13 | 13 |
|
14 | 14 | # Capacity of an Azure API Management instance
|
15 | 15 |
|
16 |
| -[!INCLUDE [api-management-availability-premium-dev-standard-basic](../../includes/api-management-availability-premium-dev-standard-basic.md)] |
| 16 | +[!INCLUDE [api-management-availability-premium-dev-standard-basic-standardv2-basicv2](../../includes/api-management-availability-premium-dev-standard-basic-standardv2-basicv2.md)] |
17 | 17 |
|
18 |
| -**Capacity** is the most important [Azure Monitor metric](api-management-howto-use-azure-monitor.md#view-metrics-of-your-apis) for making informed decisions whether to [scale or upgrade](upgrade-and-scale.md) an API Management instance to accommodate more load. Its construction is complex and imposes certain behavior. |
| 18 | +API Management provides [Azure Monitor metrics](api-management-howto-use-azure-monitor.md#view-metrics-of-your-apis) to detect use of system capacity, helping you troubleshoot gateway problems and make informed decisions whether to [scale or upgrade](upgrade-and-scale.md) an API Management instance to accommodate more load. |
19 | 19 |
|
20 |
| -This article explains what the **capacity** is and how it behaves. It shows how to access **capacity** metrics in the Azure portal and suggests when to consider scaling or upgrading your API Management instance. |
| 20 | +This article explains the capacity metrics and how they behave, shows how to access capacity metrics in the Azure portal, and suggests when to consider scaling or upgrading your API Management instance. |
21 | 21 |
|
22 | 22 | [!INCLUDE [api-management-workspace-availability](../../includes/api-management-workspace-availability.md)]
|
23 | 23 |
|
24 | 24 | > [!IMPORTANT]
|
25 |
| -> This article discusses how you can monitor and scale your Azure API Management instance based upon its capacity metric. However, it is equally important to understand what happens when an individual API Management instance has actually *reached* its capacity. Azure API Management will not apply service-level throttling to prevent a physical overload of the instances. When an instance reaches its physical capacity, it will behave similar to any overloaded web server that is unable to process incoming requests: latency will increase, connections will get dropped, timeout errors will occur, and so on. This means that API clients should be prepared to deal with this possibility as they do with any other external service (for example, by applying retry policies). |
| 25 | +> This article introduces how to monitor and scale your Azure API Management instance based on capacity metrics. However, when an instance *reaches* its capacity, it won't throttle to prevent overload. Instead, it will act like an overloaded web server: increased latency, dropped connections, and timeout errors. API clients should be ready to handle these issues as they do with other external services, for example by using retry policies. |
26 | 26 |
|
27 | 27 | ## Prerequisites
|
28 | 28 |
|
29 |
| -To follow the steps in this article, you must have: |
| 29 | +To follow the steps in this article, you must have an API Management instance in one of the tiers that supports capacity metrics. For more information, see [Create an Azure API Management instance](get-started-create-service-instance.md). |
30 | 30 |
|
31 |
| -+ An active Azure subscription. |
| 31 | +## Available capacity metrics |
32 | 32 |
|
33 |
| - [!INCLUDE [quickstarts-free-trial-note](~/reusable-content/ce-skilling/azure/includes/quickstarts-free-trial-note.md)] |
| 33 | +Different capacity metrics are available in the [v2 service tiers](v2-service-tiers-overview.md) and classic tiers. |
34 | 34 |
|
35 |
| -+ An API Management instance. For more information, see [Create an Azure API Management instance](get-started-create-service-instance.md). |
| 35 | +#### [v2 tiers](#tab/v2-tiers) |
| 36 | + |
| 37 | +In the v2 tiers, the following metrics are available: |
| 38 | + |
| 39 | +* **CPU Percentage of Gateway** - The percentage of CPU capacity used by the gateway units. |
| 40 | + |
| 41 | +* **Memory Percentage of Gateway** - The percentage of memory capacity used by the gateway units. |
| 42 | + |
| 43 | +Available aggregations for these metrics are as follows. |
| 44 | + |
| 45 | +* **Avg** - Average percentage of capacity used across gateway processes in every [unit](upgrade-and-scale.md) of an API Management instance. |
| 46 | +* **Max** - Percentage of capacity in gateway process with the greatest consumption. |
| 47 | + |
| 48 | +[!INCLUDE [api-management-cpu-memory-capacity](../../includes/api-management-cpu-memory-capacity.md)] |
| 49 | + |
| 50 | +#### [Classic tiers](#tab/classic) |
| 51 | + |
| 52 | +In the Developer, Basic, Standard, and Premium tiers, the **Capacity** metric is available for making decisions about scaling or upgrading an API Management instance. Its construction is complex and imposes certain behavior. |
| 53 | + |
| 54 | +Available aggregations for this metric are as follows. |
| 55 | + |
| 56 | +* **Avg** - Average percentage of capacity used across gateway processes in every [unit](upgrade-and-scale.md) of an API Management instance. |
| 57 | +* **Max** - Percentage of capacity in gateway process with the greatest consumption. |
36 | 58 |
|
37 | 59 | [!INCLUDE [availability-capacity.md](../../includes/api-management-availability-capacity.md)]
|
38 | 60 |
|
39 |
| -## What is capacity |
| 61 | +### What the Capacity metric indicates |
40 | 62 |
|
41 | 63 | 
|
42 | 64 |
|
43 |
| -**Capacity** is an indicator of load on an API Management instance. It reflects usage of resources (CPU, memory) and network queue lengths. CPU and memory usage reveals consumption of resources by: |
| 65 | +**Capacity** is an indicator of load on an API Management instance. It reflects usage of resources (CPU, memory) and network queue lengths. |
44 | 66 |
|
45 |
| -+ API Management data plane services, such as request processing, which can include forwarding requests or running a policy. |
46 |
| -+ API Management management plane services, such as management actions applied via the Azure portal or Azure Resource Manager, or load coming from the [developer portal](api-management-howto-developer-portal.md). |
47 |
| -+ Selected operating system processes, including processes that involve cost of TLS handshakes on new connections. |
48 |
| -+ Platform updates, such as OS updates on the underlying compute resources for the instance. |
49 |
| -+ Number of APIs deployed, regardless of activity, which can consume additional capacity. |
| 67 | +[!INCLUDE [api-management-cpu-memory-capacity](../../includes/api-management-cpu-memory-capacity.md)] |
50 | 68 |
|
51 |
| -Total **capacity** is an average of its own values from every [unit](upgrade-and-scale.md) of an API Management instance. |
52 |
| - |
53 |
| -Although the **capacity metric** is designed to surface problems with your API Management instance, there are cases when problems won't be reflected in changes in the **capacity metric**. |
| 69 | +--- |
54 | 70 |
|
55 | 71 | ## Capacity metric behavior
|
56 | 72 |
|
57 |
| -Because of its construction, in real life **capacity** can be impacted by many variables, for example: |
| 73 | +In real life capacity metrics can be impacted by many variables, for example: |
58 | 74 |
|
59 | 75 | + connection patterns (new connection on a request versus reusing the existing connection)
|
60 | 76 | + size of a request and response
|
61 | 77 | + policies configured on each API or number of clients sending requests.
|
62 | 78 |
|
63 |
| -The more complex operations on the requests are, the higher the **capacity** consumption will be. For example, complex transformation policies consume much more CPU than a simple request forwarding. Slow backend service responses will increase it, too. |
| 79 | +The more complex operations on the requests are, the higher the capacity consumption is. For example, complex transformation policies consume much more CPU than a simple request forwarding. Slow backend service responses increase it, too. |
64 | 80 |
|
65 | 81 | > [!IMPORTANT]
|
66 |
| -> **Capacity** is not a direct measure of the number of requests being processed. |
| 82 | +> Capacity metrics are not direct measures of the number of requests being processed. |
67 | 83 |
|
68 | 84 | 
|
69 | 85 |
|
70 |
| -**Capacity** can also spike intermittently or be greater than zero even if no requests are being processed. It happens because of system- or platform-specific actions and should not be taken into consideration when deciding whether to scale an instance. |
| 86 | +Capacity metrics can also spike intermittently or be greater than zero even if no requests are being processed. It happens because of system- or platform-specific actions and should not be taken into consideration when deciding whether to scale an instance. |
| 87 | + |
| 88 | +Although capacity metrics are designed to surface problems with your API Management instance, there are cases when problems won't be reflected in changes in these metrics. Additionally, low capacity metrics don't necessarily mean that your API Management instance isn't experiencing any problems. |
71 | 89 |
|
72 |
| -Low **capacity metric** doesn't necessarily mean that your API Management instance isn't experiencing any problems. |
73 | 90 |
|
74 |
| -## Use the Azure portal to examine capacity |
| 91 | +## Use the Azure portal to examine capacity metrics |
| 92 | + |
| 93 | +Access metrics in the portal to understand how much capacity is used over time. |
| 94 | + |
| 95 | +#### [v2 tiers](#tab/v2-tiers) |
| 96 | + |
| 97 | +1. Navigate to your API Management instance in the [Azure portal](https://portal.azure.com/). |
| 98 | +1. In the left menu, under **Monitoring**, select **Metrics**. |
| 99 | +1. Select the **CPU Percentage of Gateway** or **Memory Percentage of Gateway** metric from the available metrics. Choose the default **Avg** aggregation or select the **Max** aggregation to see the peak usage. |
| 100 | +1. Pick a desired timeframe from the top bar of the section. |
| 101 | + |
| 102 | +> [!IMPORTANT] |
| 103 | +> Currently, the **Capacity** metric also appears in the portal for instances in v2 tiers. However, it's not supported for use in the v2 tiers and shows a value of 0. |
| 104 | +
|
| 105 | +> [!NOTE] |
| 106 | +> You can set a [metric alert](api-management-howto-use-azure-monitor.md#set-up-an-alert-rule) to let you know when something unexpected is happening. For example, get notifications when your API Management instance has exceeded its expected peak CPU or Memory usage for more than 20 minutes. |
| 107 | + |
| 108 | + |
| 109 | +#### [Classic tiers](#tab/classic) |
75 | 110 |
|
76 | 111 | 
|
77 | 112 |
|
78 | 113 | 1. Navigate to your API Management instance in the [Azure portal](https://portal.azure.com/).
|
79 |
| -2. In the left menu, under **Monitoring**, select **Metrics**. |
80 |
| -3. Select the **Capacity** metric from the available metrics and leave the default **Avg** aggregation. |
| 114 | +1. In the left menu, under **Monitoring**, select **Metrics**. |
| 115 | +1. Select the **Capacity** metric from the available metrics and leave the default **Avg** aggregation. |
81 | 116 |
|
82 | 117 | > [!TIP]
|
83 | 118 | > If you've deployed your instance to multiple locations, you should always look at a **capacity** metric breakdown per location to avoid wrong interpretations.
|
84 | 119 |
|
85 |
| -4. To split the metric by location, from the section at the top, select **Apply splitting** and then select **Location**. |
86 |
| -5. Pick a desired timeframe from the top bar of the section. |
| 120 | +1. To split the metric by location, from the section at the top, select **Apply splitting** and then select **Location**. |
| 121 | +1. Pick a desired timeframe from the top bar of the section. |
| 122 | + |
| 123 | +> [!IMPORTANT] |
| 124 | +> Currently, the **CPU Percentage of Gateway** and **Memory Consumption of Gateway** metrics also appear in the portal for instances in classic tiers. However, they're not supported for use in classic tiers and show a value of 0. |
| 125 | +
|
| 126 | + |
87 | 127 |
|
88 |
| - You can set a [metric alert](api-management-howto-use-azure-monitor.md#set-up-an-alert-rule) to let you know when something unexpected is happening. For example, get notifications when your API Management instance has exceeded its expected peak capacity for more than 20 minutes. |
89 | 128 |
|
90 |
| - >[!TIP] |
91 |
| - > You can configure alerts to let you know when your service is running low on capacity or use Azure Monitor [autoscaling](api-management-howto-autoscale.md) to automatically add an Azure API Management unit. Scaling operation can take around 30 minutes, so you should plan your rules accordingly. |
92 |
| - > Only scaling the master location is allowed. |
| 129 | + |
| 130 | +> [!NOTE] |
| 131 | +> * You can set a [metric alert](api-management-howto-use-azure-monitor.md#set-up-an-alert-rule) to let you know when something unexpected is happening. For example, get notifications when your API Management instance has exceeded its expected peak capacity for more than 20 minutes. |
| 132 | +> * You can use Azure Monitor [autoscaling](api-management-howto-autoscale.md) to automatically add an Azure API Management unit. Scaling operation can take around 30 minutes, so you should plan your rules accordingly. |
| 133 | +> * In multi-region deployments, only scaling the primary location is allowed. |
| 134 | +
|
| 135 | +--- |
93 | 136 |
|
94 | 137 | ## Use capacity for scaling decisions
|
95 | 138 |
|
96 |
| -**Capacity** is the metric for making decisions whether to scale an API Management instance to accommodate more load. The following are general considerations: |
| 139 | +Use capacity metrics for making decisions whether to scale an API Management instance to accommodate more load. The following are general considerations: |
97 | 140 |
|
98 | 141 | + Look at a long-term trend and average.
|
99 | 142 | + Ignore sudden spikes that are most likely not related to an increase in load (see [Capacity metric behavior](#capacity-metric-behavior) section for explanation).
|
100 |
| -+ As a general rule, upgrade or scale your instance when the **capacity** value exceeds **60% - 70%** for a long period of time (for example, 30 minutes). Different values may work better for your service or scenario. |
101 |
| -+ If your instance is configured with only 1 unit, upgrade or scale your instance when the **capacity** value exceeds **40%** for a long period. This recommendation is based on the need to reserve capacity for guest OS updates in the underlying service platform. |
| 143 | ++ As a general rule, upgrade or scale your instance when a capacity metric value exceeds **60% - 70%** for a long period of time (for example, 30 minutes). Different values may work better for your service or scenario. |
| 144 | ++ If your instance is configured with only 1 unit, upgrade or scale your instance when a capacity metric value exceeds **40%** for a long period. This recommendation is based on the need to reserve capacity for guest OS updates in the underlying service platform. |
102 | 145 |
|
103 | 146 | >[!TIP]
|
104 | 147 | > If you are able to estimate your traffic beforehand, test your API Management instance on workloads you expect. You can increase the request load on your tenant gradually and monitor the value of the capacity metric that corresponds to your peak load. Follow the steps from the previous section to use Azure portal to understand how much capacity is used at any given time.
|
105 | 148 |
|
106 |
| -## Next steps |
| 149 | +## Related content |
107 | 150 |
|
108 | 151 | - [Upgrade and scale an Azure API Management service instance](upgrade-and-scale.md)
|
109 | 152 | - [Automatically scale an Azure API Management instance](api-management-howto-autoscale.md)
|
110 |
| -- [Plan and manage costs for API Management](plan-manage-costs.md) |
| 153 | +- [Plan and manage costs for API Management](plan-manage-costs.md) |
0 commit comments