Re: Token buckets question

From: Pavel Bykov <slidersv_at_gmail.com>
Date: Fri, 14 Oct 2011 12:51:53 +0200

Joe, there are also "Deficit Shapers" (as I call them) in hardware
platforms, that don't use explicit Tc to refill the bucket periodically.
SRR on the Catalyst 2960/3560/3750 series is one example.
Such shapers function essentially without a bucket, just like you described
for a policer.
So a packet arrives, e.g. 1500B packet, and it is sent. The Deficit count
right now is -1500B. So now the system needs to wait for Deficit to reach
back to 0. When another packet arrives, it checks if the deficit count is 0.
If its less than 0, then it continues waiting (therefore performing
shaping). If the deficit count is 0, it sends the packet.
Another example is 6500, which has a hardware based TC interval (1/4000 of a
second or so). That works just as you described.

In essensce, the Policer does not require a Tc, because its a simple YES/NO
decision. But Shaper requires a Tc, because it's not a simple YES/NO. In
shaper its either YES (send), or NO (queue) but then when will be YES? So
the system needs to track that somehow. And its then up to the architecture
developers to either create a cool hardware hack that uses hardware clock,
or they can opt for something easy, like Tc tracking in software on the
software routers (that's why we can't have very short Tc intervals on the
software platforms - there is just not enough CPU cycles to constantly check
the Tc)

On Thu, Oct 13, 2011 at 8:00 AM, Joe Astorino <joeastorino1982_at_gmail.com>wrote:

> Depends on if you are talking about a shaper or a policer. With a shaper,
> tokens are added to the bucket usually based on a set static amount of time
> called Tc. This is where we get the popular formula Tc = Bc/CIR. For
> instance, with FRTS our Tc is 1/8 seconds so every 1/8th of a second we get
> bc tokens into the bucket. With a policer, the logic is different and
> tokens are added to the bucket based on packet arrival time, not some
> static
> Tc as in shaping. With a policer, basically it looks at the CIR and it
> looks
> at the last time that you received a packet, and it prorates you some
> amount
> of tokens based on those things. So if your CIR was 100,000 bits/second
> and
> the last time you received a packet was .5 seconds ago you would
> instantaneously get 50,000 tokens. That is a little simplified because
> typically policers specify the token bucket in terms of bytes, not bits.
>
> HTH
>
> On Tue, Oct 11, 2011 at 11:22 PM, Jacek <q.192.168.1.0_at_gmail.com> wrote:
>
> > Hello Experts,
> >
> > I have a question, how often tokens are added to token buckets?
> > Different docs give different explenations:
> >
> > 1.
> > Cisco book End-to-end QOS network design says:
> > "policer has two separate buckets that are filled EACH SECOND with two
> > separate token rates."
> > If I understand correctly, buckets are refilled only one time per
> > second. It does not look very often to me.
> >
> > 2.
> > RFC 2698 ( http://tools.ietf.org/html/rfc2698 ) says: " token count Tc
> > is incremented by one CIR times per second up to CBS."
> > Does this mean that if CIR=100,000bps then 100 tokens are put into the
> > bucket every millisecond ? Just curious, can router count tokens that
> > fast ?
> >
> > Can someone please explain ?
> >
> > Thanks
> >
> >
> > Blogs and organic groups at http://www.ccie.net
> >
> > _______________________________________________________________________
> > Subscription information may be found at:
> > http://www.groupstudy.com/list/CCIELab.html
> >
> >
> >
> >
> >
> >
> >
> >
>
>
> --
> Regards,
>
> Joe Astorino
> CCIE #24347
> Blog: http://astorinonetworks.com
>
> "He not busy being born is busy dying" - Dylan
>
>
> Blogs and organic groups at http://www.ccie.net
>
> _______________________________________________________________________
> Subscription information may be found at:
> http://www.groupstudy.com/list/CCIELab.html
>
>
>
>
>
>
>
>

-- 
Pavel Bykov
Blogs and organic groups at http://www.ccie.net
Received on Fri Oct 14 2011 - 12:51:53 ART

This archive was generated by hypermail 2.2.0 : Tue Nov 15 2011 - 13:10:29 ART