Author Topic: How does token bucket allows bursty output traffic?  (Read 749 times)

0 Members and 1 Guest are viewing this topic.

Offline shivajikobardanTopic starter

  • Regular Contributor
  • *
  • Posts: 71
  • Country: np
How does token bucket allows bursty output traffic?
« on: February 14, 2026, 08:24:39 am »
I read a lot on this but cannot conclude. I have been stuck on this topic since years. And for some reason, it does not have learning materials that proper.

Slides: https://www.cs.ucc.ie/~gprovan/CS6323/2014/L11-Congesion-Control.pdf
 

Online magic

  • Super Contributor
  • ***
  • Posts: 8061
  • Country: pl
Re: How does token bucket allows bursty output traffic?
« Reply #1 on: February 14, 2026, 08:32:34 am »
TB is just a counter which increments at a constant rate up to a preset limit. When you pass a packet, you subtract its size from the counter. Or you drop the packet if it's larger than current count.

So if the link is idle long enough for the counter to reach full bucket capacity, a burst up to full capacity in size can pass at once. You tune bucket capacity to be the maximum burst size you want to allow and the filling rate to be the maximum average bandwidth you want to allow.
 

Offline shivajikobardanTopic starter

  • Regular Contributor
  • *
  • Posts: 71
  • Country: np
Re: How does token bucket allows bursty output traffic?
« Reply #2 on: February 14, 2026, 08:39:20 am »
> TB is just a counter which increments at a constant rate up to a preset limit. When you pass a packet, you subtract its size from the counter. Or you drop the packet if it's larger than current count.


> So if the link is idle long enough for the counter to reach full bucket capacity, a burst up to full capacity in size can pass at once. You tune bucket capacity to be the maximum burst size you want to allow and the filling rate to be the maximum average bandwidth you want to allow.




After reading your reply, it is a bit clear to me. But how is leaky bucket different than token bucket? I would like to see a proper difference.

Exceprts taken from the book by Parag Havaldar on multimedia
 

Online magic

  • Super Contributor
  • ***
  • Posts: 8061
  • Country: pl
Re: How does token bucket allows bursty output traffic?
« Reply #3 on: February 14, 2026, 09:34:04 am »
By "leaky bucket" people usually mean a policy similar to token bucket but with built-in buffering.

Instead of counting tokens you store received packets in a buffer (of limited capacity) and release them at a constant rate. If the buffer overfills you drop further packets. Bursts up to a certain size (current free capacity) can be accepted, but they will be slowly sent out later.

This ensures that the outgoing link is never saturated to 100% and leaves capacity for other packet flows to operate concurrently with low latency.
 

Offline paulca

  • Super Contributor
  • ***
  • Posts: 6389
  • Country: gb
Re: How does token bucket allows bursty output traffic?
« Reply #4 on: February 14, 2026, 10:02:24 am »
Think about two pubs and bouncers (doormen).

The Leaky pub the bouncer just lets one new punter in per minute.  From experience this works for them and ends up matching the rate people leave anyway.

The TBF pub the bouncer has a bag of tokens.  As people enter the pub he gives them a token each.  When people leave the pub they return their token.

In the Leaky pub if you are in a party of 5, you each enter 1 minute apart taking 5 minutes.  If you went to the TBF pub and he has 5 tokens available, you all go in together.

Note.  The TBF pub scenario here involves the tokens being given back to the bucket/bag.  In actual traffic shaping they are usually just "generated" on a timer.

Also in the real world...  TBFs are usually stacked and can borrow/share tokens.
"What could possibly go wrong?"
Current Open Projects:  68000 Self Build computer + OS.
 

Offline shivajikobardanTopic starter

  • Regular Contributor
  • *
  • Posts: 71
  • Country: np
Re: How does token bucket allows bursty output traffic?
« Reply #5 on: February 14, 2026, 10:36:27 am »
By "leaky bucket" people usually mean a policy similar to token bucket but with built-in buffering.

Instead of counting tokens you store received packets in a buffer (of limited capacity) and release them at a constant rate. If the buffer overfills you drop further packets. Bursts up to a certain size (current free capacity) can be accepted, but they will be slowly sent out later.

This ensures that the outgoing link is never saturated to 100% and leaves capacity for other packet flows to operate concurrently with low latency.

I think(as far as I have read) policer does not buffer. There is option in both token and leaky bucket for buffering is what I mean.
 

Offline shivajikobardanTopic starter

  • Regular Contributor
  • *
  • Posts: 71
  • Country: np
Re: How does token bucket allows bursty output traffic?
« Reply #6 on: February 14, 2026, 10:37:33 am »
Think about two pubs and bouncers (doormen).

The Leaky pub the bouncer just lets one new punter in per minute.  From experience this works for them and ends up matching the rate people leave anyway.

The TBF pub the bouncer has a bag of tokens.  As people enter the pub he gives them a token each.  When people leave the pub they return their token.

In the Leaky pub if you are in a party of 5, you each enter 1 minute apart taking 5 minutes.  If you went to the TBF pub and he has 5 tokens available, you all go in together.

Note.  The TBF pub scenario here involves the tokens being given back to the bucket/bag.  In actual traffic shaping they are usually just "generated" on a timer.

Also in the real world...  TBFs are usually stacked and can borrow/share tokens.

I get that now.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf