How to handle API throttling for queries

更新时间:
复制 MD 格式

A Throttling.User or Request was denied due to user flow control error when you call the DescribeMetricLast or DescribeMetricList API means your requests are being throttled. Learn why throttling occurs and how to resolve it.

Causes of throttling

The DescribeMetricLast and DescribeMetricList APIs have a rate limit of 50 queries per second (QPS). Requests that exceed this limit are throttled.

Query the peak QPS

  • To query the API rate limit, see API Rate Limits.

    In the API Rate Limits list, you can view the quotas and peak values for DescribeMetricLast and DescribeMetricList.

  • To check API rate limit usage and evaluate the peak value, see API Rate Limit Usage.

    In the monitoring chart for API Rate Limit Usage (%), find the peak value and calculate the peak QPS. For example, if the API rate limit is 50 and the peak usage is 5%, the peak QPS is 50 × 0.05 = 2.5.

Solutions

  1. Query metrics in batches.

    For example, to query 50 ECS instances, you can set the Dimensions request parameter to [{"instanceId":"InstanceA"},{"instanceId":"InstanceB"}]. This lets you query all instances in a single request.

    Note

    A single request can query up to 50 instances in a batch.

  2. Use peak-load shifting to spread API calls over time and reduce the peak QPS.

    For example, you have 10 cloud products, each with 10 metrics queried every 10 seconds. Querying all metrics at once results in a QPS of 100. Spreading the queries evenly over the 10-second period reduces the QPS to 10.

  3. Use the real-time data export feature to export monitoring data.

    This feature is cost-effective, low-latency, and highly reliable. The BatchExport API supports up to 1,000 queries per second.

  4. If none of these solutions resolve the issue, submit a ticket.

References