Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

Leaking bucket algorithm

Sumit Rawal answered on May 21, 2023 Popularity 1/10 Helpfulness 1/10

Contents


More Related Answers

  • Token Bucket Algorithm

  • Leaking bucket algorithm

    0

    The leaking bucket algorithm is similar to the token bucket except that requests are processed at a fixed rate. It is usually implemented with a first-in-first-out (FIFO) queue. The algorithm works as follows:

    When a request arrives, the system checks if the queue is full. If it is not full, the request is added to the queue.

    Otherwise, the request is dropped.

    Requests are pulled from the queue and processed at regular intervals.

    Figure 7 explains how the algorithm works.

    Figure 7

    Figure 7

    Leaking bucket algorithm takes the following two parameters:

    Bucket size: it is equal to the queue size. The queue holds the requests to be processed at a fixed rate.

    Outflow rate: it defines how many requests can be processed at a fixed rate, usually in seconds.

    Shopify, an ecommerce company, uses leaky buckets for rate-limiting [7].

    Pros:

    Memory efficient given the limited queue size.

    Requests are processed at a fixed rate therefore it is suitable for use cases that a stable outflow rate is needed.

    Cons:

    A burst of traffic fills up the queue with old requests, and if they are not processed in time, recent requests will be rate limited.

    There are two parameters in the algorithm. It might not be easy to tune them properly.

    Popularity 1/10 Helpfulness 1/10 Language whatever
    Source: Grepper
    Link to this answer
    Share Copy Link
    Contributed on May 21 2023
    Sumit Rawal
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.