Rate Limiting - Simplified

Rate Limiting - Simplified

What is rate limiting ?

Nothing, but a technique to protect a system from excessive or malicious requests that could overload servers, degrade performance, or lead to denial-of-service (DoS) attacks.

HTTP Response Status Code 429. Read more.

No alt text provided for this image
Rate Limiter Explained

Image Credits: https://www.wallarm.com/what/rate-limiting


Token bucket algorithm

The token bucket algorithm is widely used for rate limiting. It is straightforward, easily understood, and frequently utilized by online businesses.

Following is how the token bucket algorithm operates:

  • A container with a predetermined capacity is called a token bucket.
  • Periodically, tokens are added to the bucket at predetermined rates.
  • No additional tokens are added to the bucket after it is full.
  • Every second, the re-filler adds 2 tokens to the bucket. Extra tokens will spill out once the bucket is full.

No alt text provided for this image
Token bucket algorithm


要查看或添加评论,请登录

Ankit Kumar的更多文章

  • Demystifying JSON Web Tokens (JWTs)

    Demystifying JSON Web Tokens (JWTs)

    JSON Web Tokens (JWTs) are secure, compact tokens used for sharing data between parties. They play a vital role in…

社区洞察

其他会员也浏览了