遏制Throttling

配置存储对其可提供服务的请求存在限制。Configuration stores have limits on the requests that they may serve. 超过配置存储分配的配额的请求都将收到 HTTP 429(请求太多)响应。Any requests that exceed an allotted quota for a configuration store will receive an HTTP 429 (Too Many Requests) response.

限制分为不同的配额策略:Throttling is divided into different quota policies:

  • 总请求数 - 请求总数Total Requests - total number of requests
  • 总带宽 - 出站数据(以字节为单位)Total Bandwidth - outbound data in bytes
  • 存储量 - 用户数据的总存储大小(以字节为单位)Storage - total storage size of user data in bytes

处理受限响应Handling throttled responses

达到给定配额的速率限制后,服务器将使用状态代码 429 来响应此类型的后续请求。When the rate limit for a given quota has been reached, the server will respond to further requests of that type with a 429 status code. 429 响应将包含一个 retry-after-ms 标头,它向客户端提供在准许补充请求配额之前建议的等待时间(毫秒) 。The 429 response will contain a retry-after-ms header providing the client with a suggested wait time (in milliseconds) to allow the request quota to replenish.

HTTP/1.1 429 (Too Many Requests)
retry-after-ms: 10
Content-Type: application/problem+json; charset=utf-8
{
  "type": "https://azconfig.io/errors/too-many-requests",
  "title": "Resource utilization has surpassed the assigned quota",
  "policy": "Total Requests",
  "status": 429
}

在上述示例中,客户端超过了它允许的配额,系统建议它放慢速度,等待 10 毫秒,然后再尝试任何后续请求。In the above example, the client has exceeded its allowed quota and is advised to slow down and wait 10 milliseconds before attempting any further requests. 客户端还应考虑渐进式回退。Clients should consider progressive backoff as well.

其他重试Other retry

此服务可识别除限制外需要客户端重试的其他情况(例如:503 服务不可用)。The service may identify situations other than throttling that need a client retry (ex: 503 Service Unavailable). 在所有这类情况下,都将提供 retry-after-ms 响应头。In all such cases, the retry-after-ms response header will be provided. 为了提高可靠性,建议客户端采用建议的时间间隔并执行重试。To increase robustness, the client is advised to follow the suggested interval and perform a retry.

HTTP/1.1 503 Service Unavailable
retry-after-ms: 787