forked from docs/doc-exports
Reviewed-by: Mützel, Andrea <andrea.muetzel@t-systems.com> Co-authored-by: Chen, Junjie <chenjunjie@huawei.com> Co-committed-by: Chen, Junjie <chenjunjie@huawei.com>
24 KiB
24 KiB
Request Throttling 2.0
A request throttling 2.0 policy limits the number of times that an API can be called within a specific time period. Parameter-based, basic, and excluded throttling is supported.
- Basic throttling
Throttle requests by API, user, credential, or source IP address. This function is equivalent to a traditional request throttling policy (see Request Throttling) but is incompatible with it.
- Parameter-based throttling
Throttle requests based on headers, path parameter, method, query strings, or system parameters.
- Excluded throttling

If your gateway does not support this policy, contact technical support to upgrade the gateway to the latest version.
Usage Guidelines
- You have understood the guidelines for policy creation and API binding.
- A request throttling policy becomes invalid if a request throttling 2.0 policy is bound to the same API as the existing one.
- You can define a maximum of 100 parameter-based throttling rules. The parameter name can contain 1 to 32 characters.
- The policy content cannot exceed 65,535 characters.
Parameter Description
Example Script
{ "scope": "basic", "default_interval": 60, "default_time_unit": "second", "api_limit": 100, "app_limit": 50, "user_limit": 50, "ip_limit": 20, "specials": [ { "type": "app", "policies": [ { "key": "e9230d70c749408eb3d1e838850cdd23", "limit": 10 } ] }, { "type": "user", "policies": [ { "key": "878f1b87f71c40a7a15db0998f358bb9", "limit": 10 } ] } ], "algorithm": "counter", "parameters": [ { "id": "3wuj354lpptv0toe0", "value": "reqPath", "type": "path", "name": "reqPath" }, { "id": "53h7e7j11u38l3ocp", "value": "method", "type": "method", "name": "method" }, { "id": "vv502bnb6g40td8u0", "value": "Host", "type": "header", "name": "Host" } ], "rules": [ { "match_regex": "[\"Host\",\"==\",\"www.abc.com\"]", "rule_name": "u8mb", "time_unit": "second", "interval": 2, "limit": 5 } ] }
Parent topic: API Policies