0
0
HLDsystem_design~5 mins

Rate limiting algorithms (token bucket, leaky bucket) in HLD - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the main purpose of rate limiting in system design?
Rate limiting controls how many requests a user or system can make in a given time to prevent overload and ensure fair resource use.
Click to reveal answer
beginner
Describe the Token Bucket algorithm in simple terms.
Token Bucket allows requests if there are tokens available. Tokens are added at a steady rate. Each request uses one token. If no tokens, request is denied or delayed.
Click to reveal answer
beginner
How does the Leaky Bucket algorithm control request flow?
Leaky Bucket processes requests at a fixed rate. Excess requests wait in a queue. If the queue is full, new requests are dropped.
Click to reveal answer
intermediate
What is a key difference between Token Bucket and Leaky Bucket algorithms?
Token Bucket allows bursts of requests up to token count, while Leaky Bucket smooths out bursts by processing at a constant rate.
Click to reveal answer
intermediate
Why might a system choose Token Bucket over Leaky Bucket for rate limiting?
Token Bucket is better for systems that allow short bursts of traffic, giving flexibility while still controlling average rate.
Click to reveal answer
Which rate limiting algorithm allows bursts of requests up to a token limit?
AToken Bucket
BLeaky Bucket
CFixed Window
DSliding Log
In the Leaky Bucket algorithm, what happens when the queue is full and a new request arrives?
AThe request is dropped
BThe request is processed immediately
CThe bucket refills tokens
DThe request is delayed indefinitely
Which algorithm processes requests at a fixed, steady rate?
ASliding Window
BToken Bucket
CLeaky Bucket
DFixed Window
What does a token represent in the Token Bucket algorithm?
AA dropped request
BPermission to process one request
CA queued request
DA fixed time interval
Why is rate limiting important in distributed systems?
ATo reduce network latency
BTo increase request speed
CTo store more data
DTo prevent system overload and ensure fair use
Explain how the Token Bucket algorithm works and when it is useful.
Think of tokens as tickets to make requests.
You got /4 concepts.
    Describe the Leaky Bucket algorithm and how it differs from Token Bucket.
    Imagine water leaking from a bucket at a steady rate.
    You got /5 concepts.