Token Bucket Regulation: Duration of Full-Rate Transmission
In a token bucket regulator, the system “spends” tokens to allow sending at the link’s line rate (here Mbps). Tokens are generated continuously at a fixed token generation rate and stored up to a maximum bucket capacity.
Key idea: when the computer transmits at full Mbps, it consumes tokens at Mbps; meanwhile, new tokens are added at Mbps. Thus, the bucket level decreases at the net rate Mbps. The time you can keep transmitting at full Mbps is determined by how long it takes for the initial stored tokens (capacity) to be depleted.
Model the token level in bits:
- Initial tokens: megabits
- Token arrival (fill) rate: Mbps
- Token consumption at full send: Mbps
So,
Mermaid intuition (token level over time while sending at full rate):
Therefore, the computer can transmit at the full Mbps for seconds.
Token Bucket Traffic Shaping (Conceptual Tutorial)
Compute maximum full-rate transmission time under token bucket
- 1Step 1
Let initial tokens (bucket capacity) be Mb, token generation rate be Mbps, and full link rate be Mbps.
- 2Step 2
While sending at full , tokens are consumed at but added at , so net drain rate is Mbps.
- 3Step 3
Transmission can continue at full rate until tokens reach 0, so .
- 4Step 4
Maximum full-rate burst duration is seconds.
Pro Tip: Use the net drain shortcut
When the sender is at full link rate , tokens decrease at rate . If the bucket starts full with bits, then the full-rate duration is simply
Warning: Assumes bit-for-bit token spending
This solution assumes the regulator consumes tokens proportionally to transmitted bits (i.e., Mbps of sending consumes Mbps worth of tokens). If your course uses a packet-based model (tokens per packet size), you must convert to “tokens per packet” and incorporate packetization.
Token bucket burst lifecycle at full 6 Mbps
Bucket initially full
t = 0Tokens start at Mb."
Transmit at full line rate
0 < t < 1.6sConsumption Mbps; generation Mbps; net drain Mbps."
Bucket empties
t = 1.6sTokens hit , so transmission at full Mbps can no longer be sustained."
Constrained by token replenishment
t > 1.6sTransmission must slow (or pause) to match available tokens."
Token rates during full-rate transmission
Consumption vs generation determine the net drain
Key concepts & common pitfalls
Knowledge Check
A token bucket has initial tokens Mb, fill rate Mbps, and the sender transmits at line rate Mbps. How long can it sustain full Mbps?