Basic traffic throttling plugin is a powerful traffic throttling component provided by API Gateway. It can throttle traffic in three dimensions of API, application, and client IP by second, minute, hour, or day. You can create a basic traffic throttling plugin and bind it to your API to take effect and protect your backend services.
Parameter | Required | Description |
---|---|---|
Duration | Yes | The duration of traffic throttling, which supports four dimensions: second, minute, hour, and day. It is used in conjunction with "traffic throttling threshold" to indicate the upper limit of the number of requests per unit time. |
API Threshold | Yes | The upper limit of the number of times an API can be accessed within a certain period of time. |
Application Threshold | No | The upper limit of the number of times an application can be accessed within a certain period of time, which takes effect for all applications bound to this API. |
Client IP Threshold | No | The upper limit of the number of times a client IP can be accessed within a certain period of time, which takes effect for all client IPs bound to this API. |
Special Application | No | Up to 30 items can be entered. For such applications, the basic API traffic throttling of the traffic throttling policy still takes effect, but you need to set an additional traffic throttling threshold for them. Meanwhile, the basic application traffic throttling and user traffic throttling of the traffic throttling policy will stop working for such applications. |
No | Up to 30 items can be entered. For such IPs, the basic API traffic throttling of the traffic throttling policy still takes effect, but you need to set an additional traffic throttling threshold for them. Meanwhile, the basic application traffic throttling and client IP traffic throttling of the traffic throttling policy will stop working for such IPs. |
{
"expire_type":"hour", // Traffic throttling time window unit. Valid values: day, hour, minute, second
"expire":1, // Traffic throttling time window
"api_rate_limit":500, // API traffic throttling threshold, which must be a positive integer
"app_rate_limit":1, // Application traffic throttling threshold, which must be a positive integer
"ip_rate_limit":2, // Client IP traffic throttling threshold, which must be a positive integer
"spec_app_rate_limits":[ // List of special applications for traffic throttling
{
"app_id":"app-3q9l4909", // Application ID
"rate_limit":10 // Traffic throttling threshold, which must be a positive integer
}
],
"spec_ip_rate_limits":[ // List of special client IPs for traffic throttling
{
"ip_key":"172.16.0.1", // Client IP
"rate_limit":10 // Traffic throttling threshold, which must be a positive integer
}
]
}
The basic traffic throttling plugin will be affected by service traffic throttling and API traffic throttling. If multiple traffic throttling rules take effect at the same time, the lowest threshold will prevail.
For example, if the traffic throttling threshold of an API is set to 500 QPS in the basic traffic throttling plugin, the traffic throttling threshold of the service to which the API belongs is 100 QPS, and the traffic throttling threshold of the API itself is 50 QPS, then the actually effective threshold is 50 QPS.
Was this page helpful?