Skip to content

Commit 1232b4d

Browse files
authored
Merge pull request #220623 from dlepow/shgwpol
[APIM] Self-hosted gateway policy clarifications
2 parents 59f1acc + b494c3f commit 1232b4d

5 files changed

+42
-8
lines changed

articles/api-management/api-management-gateways-overview.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ The API Management *gateway* (also called *data plane* or *runtime*) is the serv
2727

2828
[!INCLUDE [api-management-gateway-role](../../includes/api-management-gateway-role.md)]
2929

30+
31+
> [!NOTE]
32+
> All requests to the API Management gateway, including those rejected by policy configurations, count toward configured rate limits, quotas, and billing limits if applied in the service tier.
33+
34+
3035
## Managed and self-hosted
3136

3237
API Management offers both managed and self-hosted gateways:
@@ -52,6 +57,7 @@ The following table compares features available in the managed gateway versus th
5257

5358
> [!NOTE]
5459
> * Some features of managed and self-hosted gateways are supported only in certain [service tiers](api-management-features.md) or with certain [deployment environments](self-hosted-gateway-overview.md#packaging) for self-hosted gateways.
60+
> * For the current supported features of the self-hosted gateway, ensure that you have upgraded to the latest major version of the self-hosted gateway [container image](self-hosted-gateway-overview.md#container-images).
5561
> * See also self-hosted gateway [limitations](self-hosted-gateway-overview.md#limitations).
5662
5763
### Infrastructure
@@ -92,17 +98,19 @@ The following table compares features available in the managed gateway versus th
9298

9399
### Policies
94100

95-
Managed and self-hosted gateways support all available [policies](api-management-howto-policies.md) in policy definitions with the following exceptions.
101+
Managed and self-hosted gateways support all available [policies](api-management-policies.md) in policy definitions with the following exceptions.
96102

97-
| Policy | Managed (Dedicated) | Managed (Consumption) | Self-hosted |
103+
| Policy | Managed (Dedicated) | Managed (Consumption) | Self-hosted<sup>1</sup> |
98104
| --- | ----- | ----- | ---------- |
99-
| [Dapr integration](api-management-dapr-policies.md) ||| ✔️ |
105+
| [Dapr integration](api-management-policies.md#dapr-integration-policies) ||| ✔️ |
100106
| [Get authorization context](get-authorization-context-policy.md) | ✔️ |||
101-
| [Quota and rate limit](api-management-access-restriction-policies.md) | ✔️ | ✔️<sup>1</sup> | ✔️<sup>2</sup>
107+
| [Quota and rate limit](api-management-policies.md#access-restriction-policies) | ✔️ | ✔️<sup>2</sup> | ✔️<sup>3</sup>
102108
| [Set GraphQL resolver](set-graphql-resolver-policy.md) | ✔️ |||
103109

104-
<sup>1</sup> The rate limit by key and quota by key policies aren't available in the Consumption tier.<br/>
105-
<sup>2</sup> By default, rate limit counts in self-hosted gateways are per-gateway, per-node.
110+
<sup>1</sup> Configured policies that aren't supported by the self-hosted gateway are skipped during policy execution.<br/>
111+
<sup>2</sup> The rate limit by key and quota by key policies aren't available in the Consumption tier.<br/>
112+
<sup>3</sup> [!INCLUDE [api-management-self-hosted-gateway-rate-limit](../../includes/api-management-self-hosted-gateway-rate-limit.md)] [Learn more](how-to-self-hosted-gateway-on-kubernetes-in-production.md#request-throttling)
113+
106114

107115
### Monitoring
108116

articles/api-management/how-to-self-hosted-gateway-on-kubernetes-in-production.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ms.service: api-management
77
ms.workload: mobile
88
ms.topic: article
99
ms.author: tomkerkhove
10-
ms.date: 12/17/2021
10+
ms.date: 01/17/2023
1111
---
1212

1313
# Guidance for running self-hosted gateway on Kubernetes in production
@@ -173,6 +173,16 @@ By default, a self-hosted gateway is deployed with a **RollingUpdate** deploymen
173173

174174
We recommend reducing container logs to warnings (`warn`) to improve for performance. Learn more in our [self-hosted gateway configuration reference](self-hosted-gateway-settings-reference.md).
175175

176+
## Request throttling
177+
178+
Request throttling in a self-hosted gateway can be enabled by using the API Management [rate-limit](rate-limit-policy.md) or [rate-limit-by-key](rate-limit-by-key-policy.md) policy. Configure rate limit counts to synchronize among gateway instances across cluster nodes by exposing the following ports in the Kubernetes deployment for instance discovery:
179+
180+
* Port 4290 (UDP), for the rate limiting synchronization
181+
* Port 4291 (UDP), for sending heartbeats to other instances
182+
183+
> [!NOTE]
184+
> [!INCLUDE [api-management-self-hosted-gateway-rate-limit](../../includes/api-management-self-hosted-gateway-rate-limit.md)]
185+
176186
## Security
177187
The self-hosted gateway is able to run as non-root in Kubernetes allowing customers to run the gateway securely.
178188

@@ -195,6 +205,7 @@ securityContext:
195205
> [!WARNING]
196206
> When using local CA certificates, the self-hosted gateway must run with user ID (UID) `1001` in order to manage the CA certificates otherwise the gateway will not start up.
197207

208+
198209
## Next steps
199210

200211
* To learn more about the self-hosted gateway, see [Self-hosted gateway overview](self-hosted-gateway-overview.md).

articles/api-management/rate-limit-by-key-policy.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ To understand the difference between rate limits and quotas, [see Rate limits an
5656
- [**Policy scopes:**](./api-management-howto-policies.md#scopes) global, product, API, operation
5757
- [**Gateways:**](api-management-gateways-overview.md) dedicated, self-hosted
5858

59+
### Usage notes
60+
61+
* [!INCLUDE [api-management-self-hosted-gateway-rate-limit](../../includes/api-management-self-hosted-gateway-rate-limit.md)] [Learn more](how-to-self-hosted-gateway-on-kubernetes-in-production.md#request-throttling)
62+
63+
5964
## Example
6065

6166
In the following example, the rate limit of 10 calls per 60 seconds is keyed by the caller IP address. After each policy execution, the remaining calls allowed in the time period are stored in the variable `remainingCallsPerIP`.

articles/api-management/rate-limit-policy.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ author: dlepow
66

77
ms.service: api-management
88
ms.topic: reference
9-
ms.date: 12/08/2022
9+
ms.date: 01/11/2023
1010
ms.author: danlep
1111
---
1212

@@ -86,6 +86,8 @@ To understand the difference between rate limits and quotas, [see Rate limits an
8686
* This policy can be used only once per policy definition.
8787
* Except where noted, [policy expressions](api-management-policy-expressions.md) can't be used in attribute values for this policy.
8888
* This policy is only applied when an API is accessed using a subscription key.
89+
* [!INCLUDE [api-management-self-hosted-gateway-rate-limit](../../includes/api-management-self-hosted-gateway-rate-limit.md)] [Learn more](how-to-self-hosted-gateway-on-kubernetes-in-production.md#request-throttling)
90+
8991

9092
## Example
9193

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
author: dlepow
3+
ms.service: api-management
4+
ms.topic: include
5+
ms.date: 01/17/2023
6+
ms.author: danlep
7+
---
8+
Rate limit counts in a self-hosted gateway can be configured to synchronize locally (among gateway instances across cluster nodes), for example, through Helm chart deployment for Kubernetes or using the Azure portal [deployment templates](../articles/api-management/how-to-deploy-self-hosted-gateway-kubernetes.md). However, rate limit counts don't synchronize with other gateway resources configured in the API Management instance, including the managed gateway in the cloud.

0 commit comments

Comments
 (0)