Each application provides many services. EDAS allows you to configure rate limiting and throttling rules for the services, ensuring service stability and rejecting traffic that exceeds the service capabilities.
EDAS configures the rate limiting and throttling rules based on the QPS and threads to ensure the system's best operation stability during traffic peaks.
HSF rate limiting: When the traffic at a traffic peak exceeds the upperlimit of the threshold defined in the throttling rules, the BlockException error occurs for some consumers. Based on the set threshold, the same number of services as set in the threshold are successfully called within 1s.
HTTP rate limiting: When a traffic peak occurs, some consumers are redirected to an error page. During actual access, the Taobao homepage is displayed. Based on the value set in the threshold, some requests are handled successfully.
Note: The throttling rules apply only to service providers and cannot be configured for service consumers. Before configuration, make sure whether the application serves as the service provider.
Add a rate limiting rule
Add the rate limiting rule code.
Log on to the EDAS console, select Applications in the left-side navigation pane to go to the application list page, and select a deployed application of the service provider to go to the application details page.
Select Rate Limiting and Degradation > Rate Limiting Rules from the left-side navigation pane of the Application Details page.
Click Application Configuration Guide in the upper right corner of the page.
Follow the steps in the application configuration guide to add the rate limiting rule code.
Compile and publish the application. For details, see Publish an application.
Click Add Rate Limiting Rules in the upper-right corner of the rate limiting rules page.
In the displayed Add Rate Limiting Rules dialog box, set the throttling rule parameters.
Description of the throttling rule parameters:
- Rate Limiting Type: This parameter can be set to "HSF Rate Limiting" or "HTTP Rate Limiting". Select a specific throttling type based on the access type of the application.
- Interface: All interfaces of the application are listed. Select the interface to be throttled as required.
- Method: All methods in the interface are automatically loaded based on the selected interface. You can select whether to throttle a specific method or all methods.
- Application: All applications in the list, except the current application, are loaded because each application may access the current application. Select the application to be throttled as required.
- Granularity: This parameter can be set to "QPS" or "Thread". QPS throttling is used to control the number of requests per second, while thread throttling is used to control the number of threads. Generally, a large thread quantity leads to a large QPS value. However, the QPS value of a thread is usually greater than 1 because a thread continuously sends requests and a request response time lasts for only tens of milliseconds.
- Throttling Threshold: Throttling is triggered if this threshold is reached.
After completing the above settings, click OK.
Note: After you configure the rate limiting rules, you can click Configure HTTP Redirections during Rate Limiting to configure redirection URL. When a service request satisfies the rate limiting rule and is throttled, the user will be redirected to the page configured here.
Manage throttling rules
On the Rate Limiting Rules page, you can Edit, Stop, Start or Delete a rule.