Baidu AI Cloud
中国站

百度智能云

API Gateway

Traffic Control Management

Introduction

The API Gateway provides the traffic control function to limit the API calling in order to protect the back-end services of API developers from overload due to too frequent calls, and guarantee the back-end resources are reasonably allocated to each APP or user. The traffic control policy is managed independently from the API. The configured traffic control policy can be bound to different APIs and become valid simultaneously for multiple API.

Create Traffic Control Policy

Select "Traffic control management" to enter the page of traffic control management:

image.png

Click "Create a new traffic control policy" to create a traffic control policy:

image.png

The traffic control policy has three dimensions. Each dimension should designate the maximum calling test n at a certain time interval t. The unit may be seconds, minutes, and hours, e.g. 1,000 times/second and 5,000 times/5 minutes. After designation, in the API calling, the number of calling times doesn't exceed n within any time interval t. The traffic control dimensions are as follows:

Dimension Description
API traffic limit The number of times that the API is called in the unit time t shouldn't exceed the set value n.
APP traffic limit The number of times that any APP calls API in the time t doesn't exceed the set value n.
User traffic limit The number of times that any cloud platform account calls API in the time t shouldn't exceed the set value n. One cloud platform account may have multiple APP, so the traffic limit of cloud platform account means the limit of total traffic of all APPs under the account.

After configuration, click "Confirm" to create a traffic control policy.

Note: The traffic is controlled after authentication. If the APP ak/sk signature authentication doesn't pass in calling, the calling is not included in the number of calls. For the API without authentication for the authentication method, the traffic control policies in the APP dimension and user dimension are invalid.

Add Special Policy

The traffic control policy limits the number of calls of API and each APP/account. Meanwhile, the API Gateway provides the traffic limitation policies for special users or special accounts. The users may add a special traffic control policy by the following steps after creating a traffic control policy. First, enter the details page of traffic control policy:

image.png

Then click "Special Application" or "Special Cloud Platform User":

image.png

Add Special Application

Click "Add special applications" to enter the following interface:

image.png

Input the ID of the special application and designate the call threshold. The threshold may be greater or less than the limitation of the traffic control policy on each application, but shouldn't be higher than the limit of API on users. The special applications are free from the impact of the traffic control policy on the traffic control value of any application.

Add Special User

Click "Add special user" to enter the following interface:

image.png

Input the ID of a special user (the user ID may be obtained via the personal center > user ID) and designate the call threshold. The threshold may be greater or less than the limitation of the traffic control policy on each user, but shouldn't be higher than the limit of API on users. The special applications are free from the impact of the traffic control policy on the traffic control value of any application.

Bind Policy to API

The traffic control policy becomes valid only after it is bound to the API. One traffic control policy may be bound to different APIs. Click the "Add Manage" button of the policy to be operated to bind it to a new API:

image.png

Select the group, the environment to be valid and API respectively. Click "Confirm" to bind after selection.

image.png

You can also click "Management" to bind and unbind the API.

Note: When binding, you should designate the environment where the API is located, and an individual environment of an individual API can be bound to one traffic control policy only.

Unbind Policy from API

Select the traffic control policy to be operated in the page of the traffic control list, and click "Management" or "Details":

image.png

Then select the API to be unbound in the tab page of the bound API list of the associated information, or directly select an individual API. Click the "Unbind" button:

image.png

Previous
Access Control
Next
Model Management