Azure API节流 [英] Azure API Throttling

查看:83
本文介绍了Azure API节流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取Azure订阅中存在的所有存储帐户的列表,但出现节流错误.

I am trying to get a list of all Storage Accounts present in my Azure subscription but I am getting a throttling error.

com.microsoft.azure.CloudException: Status code 429, {"error":{"code":"ResourceCollectionRequestsThrottled","message":"Operation 'Microsoft.Storage/storageAccounts/read' failed as server encountered too many requests. Please try after '17' seconds. Tracking Id is 'e982a894-0f3e-4291-a9b3-e147c18f8f60'."}}

在此请求之前的请求打印出来,还有13869个剩余的订阅读取,但仍然失败.

The request prior to this request prints there are 13869 more remaining subscription reads but it still fails.

x-ms-ratelimit-remaining-subscription-reads: 13869

我的订阅中大约有60个存储帐户,这个数目很小.

There are around 60 Storage Accounts in my subscription and that according is a small number.

不知道是什么原因造成的,也只有在列出存储帐户时才知道.

Any idea what's causing this and that too only while listing Storage Accounts and nowhere else.

推荐答案

根据此

对于每个订阅和租户,资源管理器将读取请求限制为每小时15,000,将写入请求限制为每小时1,200.这些限制适用于每个Azure资源管理器实例.每个Azure区域中都有多个实例,并且Azure资源管理器已部署到所有Azure区域.因此,实际上,限制实际上比上面列出的限制高得多,因为用户请求通常由许多不同的实例提供服务. 如果您的应用程序或脚本达到了这些限制,则需要限制您的请求.

For each subscription and tenant, Resource Manager limits read requests to 15,000 per hour and write requests to 1,200 per hour. These limits apply to each Azure Resource Manager instance; there are multiple instances in every Azure region, and Azure Resource Manager is deployed to all Azure regions. So, in practice, limits are effectively much higher than those listed above, as user requests are generally serviced by many different instances. If your application or script reaches these limits, you need to throttle your requests.

因此,如果达到请求限制,资源管理器将在标题中返回429 HTTP状态代码和Retry-After值. Retry-After值指定您的应用程序在发送下一个请求之前应等待(或休眠)的秒数.如果在重试值过去之前发送请求,则不会处理您的请求,并返回新的重试值.

So if you reach the request limit, Resource Manager returns the 429 HTTP status code and a Retry-After value in the header. The Retry-After value specifies the number of seconds your application should wait (or sleep) before sending the next request. If you send a request before the retry value has elapsed, your request is not processed and a new retry value is returned.

我建议您可以使用此方式以获取读取时间的数量.如果符合限制,则可以编写代码以限制应用程序发送请求.

I suggest you could use this way to get the number of the read time. If it will meet the limit, you could write codes to limit the application to send the request.

这篇关于Azure API节流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆