## What is the token bucket algorithm?

The token bucket is an algorithm that can be used to check that data transmissions, in the form of packets, conform to defined limits on bandwidth and burstiness.

## What is the difference between token bucket and leaky bucket?

The token bucket is an algorithm that can be used to check that data transmissions, in the form of packets, conform to defined limits on bandwidth and burstiness. The leaky bucket is an algorithm that can be used to determine whether some sequence of discrete events conforms to defined limits on their average and peak rates or frequencies.

## What happens to unused tokens in a bucket?

Token is removed from the bucket if it’s available and accept the request. If the token is not available then the server rejects the request. As requests are consuming tokens, we also need to refill them at some fixed rate and time, such that we never exceed the capacity of the bucket.

## What is the maximum capacity of a token bucket?

We can create a bucket with a capacity of 100, and a refill rate of 100 tokens per minute. Please refer to the Understanding Rate Limiting Algorithms blog where the Token Bucket and other algorithms have been explained in detail.