Traffic Shaping: Token Bucket vs. Leaky Bucket
💡 The Core Idea
Mechanisms to limit the rate of traffic flow. They distinguish between Policing (dropping excess) and Shaping (delaying/smoothing excess).
🧠 Comparison
Token Bucket (Allows Bursts)
- Analogy: A bucket fills with tokens at rate . To send a packet, you must “pay” with tokens.
- Behavior: If the bucket is full of tokens, a flow can send a large burst of traffic immediately (up to bucket size ).
- Use Case: Limiting average rate while tolerating short spikes.
Leaky Bucket (Smooth Output)
- Analogy: Water enters a bucket and leaks out of a hole at a constant rate .
- Behavior: Regardless of how fast packets arrive (input), they leave the bucket at a constant, rigid rate.
- Use Case: Converting bursty traffic into a constant bit rate stream.