Rate Limiting

Rate Limiting #

Type #

At present, the platform includes two types of current limiting: distributed current limiting and adaptive current limiting.

  • The distributed current limit is configured by the user. After specifying the service, configure current limit cycle and current limit times in this cycle.
  • The adaptive current limiting strategy can change adaptively according to the running state of the service. At present, we adopt codel adaptive flow control, and the specific strategy can be referred to the end of the paper.

Events #

In the Governance Center overview or platform overview, we can see the resource alert events of the platform. By clicking the specific event number, we can view the resource alert list of the service or platform. Its presentation form is as follows:

image-20211019113444327

At present, there are two types of current limiting: distributed current limiting and adaptive current limiting.

Tips

For service and system stability, adaptive current limiting will be enabled for all services by default.

Rules #

The system enables adaptive current limiting for the service by default.

image-20211019113508632

Through the “Add Current Limit Rule” or “Edit” buttons, we can configure the distributed current limit rule:

image-20211019113533825

The parameters are explained as follows:

ParamsDescription
UniqueIDThe service ID information of distributed current limiting needs to be configured
Rate limit times in the cycleThis parameter is used in conjunction with “Rate limit cycle” to specify the number of accesses within the current limiting cycle, that is, the current limiting conditions are met
Rate limit cycleThis parameter is used in conjunction with “Rate limit times in the cycle” to specify the number of accesses in a current limiting cycle, that is, the current limiting conditions are met
Whether to open the current limit for a single apiWhen limiting the current for a single API, a specific path needs to be configured
Is the rule openWhether to turn on adaptive current limiting

Appendix: adaptive flow control - codel #

Codel (controlled delay) is a “controlled delay” algorithm for overload detection, which provides a mechanism to release the load in case of overload. Even when the rate changes dynamically, it can optimize the delay while maintaining a higher throughput.

Codel can maintain a low waiting time even in case of severe overload by reducing some load in advance when the request waiting time is low. In case of load burst, the system cannot process all requests in time, so that ⽤ codel can actively discard requests with long queuing time, so as to reduce the waiting time of items in the processing queue.

Simulate the transmission of 1000 requests / s in 10 seconds, and the service runs at the rate of 500 requests / s. when the concurrency is set to 10, this is the corresponding throughput and delay of the queue and codel. It can be seen that codel improves the request delay to a good extent when the service throughput is basically the same.