Algorithms and Data Structures · Senior · Question 40 of 75

How does a token bucket rate limiter work?

Explanation

The bucket's capacity allows short bursts, and the refill rate bounds the average. It needs only two numbers per key: tokens and last refill time, so it's O(1) per request.

Further reading

Problem with a question

Algorithms and Data Structures · Senior · question 40

Test yourself

Take the Algorithms and Data Structures · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz