【发布时间】:2018-12-09 07:28:31
【问题描述】:
目前在 APIM 中,我们有产品订阅密钥级别的限制。但很明显,如果我们在同一个产品中有多个 API,一个 API 可能会消耗更多配额 超出预期并阻止其他人使用该应用程序。因此,根据 MS 文档 (https://docs.microsoft.com/en-us/azure/api-management/api-management-sample-flexible-throttling),我们可以使用组合策略。
问题在于我们是否可以使用这种方法,
API-1 300 calls per 60 seconds where product subscription key =123
API-2 200 calls per 60 seconds where product subscription key =123
API-3 200 calls per 60 seconds where product subscription key =123
如果是这样,产品订阅密钥的调用总数可能是多少?如果有意义的话。
我采用以下方法来组合策略。但它不喜欢。
<rate-limit-by-key calls="50" renewal-period="60" counter-key="@("somevalue" + context.Request.Headers.GetValueOrDefault("Ocp-Apim-Subscription-Key"))" />
<rate-limit calls="10" renewal-period="30">
<api name="AddressSearch API dev" calls="5" renewal-period="30" />
<operation name="Search_GetAddressSuggestions" calls="3" renewal-period="30" />
</rate-limit>
【问题讨论】:
-
这真的取决于您的策略是如何配置的。你能把它们贴在这里吗?
-
@VitaliyKurokhtin 我已经用细节更新了问题
标签: azure-api-management api-management