Token Bucket
Updated 2026-07-30
Summary
The token bucket is an algorithm used in packet-switched and telecommunications networks. It can be used to check that data transmissions, in the form of packets, conform to defined limits on bandwidth and burstiness (a measure of the unevenness or variations in the traffic flow). It can also be use…
Definition
An algorithm that fills a "bucket" with tokens at a fixed rate. Each data packet must consume a token to be sent. If the bucket is empty, it must wait for new tokens to be generated. This allows more data to be sent during bursts, but the long-term average rate is limited. Scaffold use: Smooth burst traffic. In resource allocation, it is necessary to ensure fairness (long-term average rate) while allowing occasional "sprints" (burst traffic). This is the core idea of all "elastic" quota systems.
Introduction
How to use
Smooth burst traffic. In resource allocation, it is necessary to ensure fairness (long-term average rate) while allowing occasional "sprints" (burst traffic). This is the core idea of all "elastic" quota systems.
Mechanism
Tokens are added to the bucket at a fixed rate. Each request consumes one token; if the bucket is empty, requests are rate-limited or queued. The bucket capacity allows short bursts, while the long-term average rate is constrained by the fill rate, balancing fairness and elasticity.
Practice
In progress 0/4Practice this model in one real situation:
Cases
- Network traffic shaping (QoS); API rate limiting; flash sale systems use token bucket to prevent abuse.
Common pitfalls
- If the bucket is too large, rate limiting becomes ineffective; mismatch between fill rate and burst can cause starvation or congestion; ignoring the complexity of cascading multiple buckets.
Sources
Source support: Explicit
References currently contain only Wikipedia links; primary sources still need review.
- en.wikipedia.orghttps://en.wikipedia.org/wiki/Token_bucketverified
account_treeGenealogyexpand_more
PRIVATE NOTES · Only visible to you
SAVED Q&A
ENTRY Q&A · Private saving available
Ask with a clear boundary
thinkingmodels answers from published entry context only.
Your question is sent to thinkingmodels. The answer uses public entry context only.
RELATED MODELS