How can we achieve a Global Rate Limiting with Azure API Management Service while using multiple APIM Services for High Availability across paired regions in round robin fashion (50/50 traffic split), as the Rate Limit config/policy is local to each APIM?
For an example, we are using 2 Azure APIM Service, one in East US 2, another in Central US having 50/50 traffic split (round robin) to each APIM Service, for better HA. The the rate limit policy applied per client is 2 API calls per minute, which is local to each APIM Service. Now the client might end up making 4 API calls within a minute before hitting throttling limit, if the requests are splitted between the APIMS in 2 different regions. In such how can we achieve a global Rate limit of 2 API calls per minute for a caller/client?
Did not find any option in Azure to achieve this yet
Yes, using a shared caching system like Azure Cache for Redis or Azure Cosmos DB to achieve global rate restriction is one method.
<rate-limit-by-key calls="number"
renewal-period="seconds"
increment-condition="condition"
increment-count="number"
counter-key="key value"
retry-after-header-name="custom header name, replaces default 'Retry-After'"
retry-after-variable-name="policy expression variable name"
remaining-calls-header-name="header name"
remaining-calls-variable-name="policy expression variable name"
total-calls-header-name="header name"/>