Current limiting algorithm

Source: Internet
Author: User

Common current-limiting algorithms are: Token bucket, leaky bucket, counter.

Token bucket Current limit

The token bucket is a bucket that holds a fixed capacity token , adds a token to the bucket at a fixed rate , fills in the discard token, requests whether it is processed to see if the token is sufficient in the bucket, and rejects the new request when the number of tokens is reduced to zero. The token bucket allows for a certain amount of bursts, as long as there is a token to handle, support to take multiple tokens at once. a token is loaded in the token bucket .

Leaky Bucket limit Flow

A fixed-capacity leaky bucket that flows out of a request at a fixed constant rate , at any rate of incoming requests, and when incoming requests accumulate into leaky bucket capacity, the new incoming request is rejected. A leaky bucket can be seen as a queue with a fixed capacity, a fixed outflow rate, and a leaky bucket limit of the requested outflow rate. The leaky bucket is loaded with a request .

Counter Current limit

It is mainly used to limit the total concurrency in a certain period of time, such as database connection pool, thread pool, and the number of seconds to kill; The counter current limit, as long as the total number of requests in a certain amount of time exceeds the set threshold, is a simple rough total quantity limit , not the average rate current limit .

Current limiting algorithm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.