Cognitive Scaffold

Preparing your thinking workspace

arrow_back_ios_new
MENTAL MODEL · M4578

Token Bucket

Token Bucket
SystemsHigh supportSystems Theory
Included
account_tree

Updated 2026-07-30

Loading revision record…

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.

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/4

Practice this model in one real situation:

Check to track your progress (stored locally)
Learning progress0%

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.

  • link
    en.wikipedia.orghttps://en.wikipedia.org/wiki/Token_bucketZH · Explicit
    verified
account_treeGenealogyexpand_more

RELATED MODELS