Traffic Shaping Excess Burst and Token Buckets

Traffic shaping includes the capability to send more than Bc in some intervals. The idea is simple: Data traffic is bursty, so after a period of inactivity, it would be nice if you could send more than Bc in the first interval after traffic occurs again. This extra number of bits is called the burst excess, or Be. Traffic-shaping tools allow Be as an option.

The underlying operation of traffic shaping to allow for Be requires a little more insight into how traffic shaping works, and it also requires us to understand the concept of token buckets. Token buckets can be used to describe how shaping and policing are implemented.

Ignoring Be for a moment, imagine a bucket filled with tokens, like subway tokens. In the token-bucket scenario, each token lets you buy the right to send 1 bit. One token bucket is used for formal operation of traffic shaping as discussed earlier; this bucket has a size of Bc. The bucket is filled to the brim, but no more, at the beginning of each Tc. Every time a packet is sent, traffic shaping spends tokens from the token bucket to buy the right to send the packet. If the packet is 1000 bits long, 1000 tokens are removed from the bucket. When traffic shaping tries to send a packet, and the bucket does not have enough tokens in it to buy the right to send the packet, traffic shaping must wait until the next interval, when the token bucket is refilled.

An analogy of token bucket is a child and the allowance the child receives every Saturday morning. For the sake of argument, assume the weekly allowance is $10. The child may spend the money every week; if the child doesn't spend it, he may save up to buy something more expensive. Imagine that the child's parents are looking at the child's piggybank every Saturday morning, however, and if they find some leftover money, they just add a little more money so that the child always starts Saturday morning with $10! After a few weeks of this practice, the child would likely try to spend all the money each week, knowing that he would never be able to save any more than $10. Similarly, the Bc of bits, or the tokens in the bucket if you prefer, are only usable in that individual Tc interval, and the next Tc (interval) always starts with Bc tokens in the bucket, but never any more.

Traffic shaping implements Be by using a second bucket that can be used to accumulate any unused tokens from the first bucket. If in interval one, traffic shaping did not need all Bc worth of tokens in the first bucket, traffic shaping would move these tokens into the second bucket. So long as each successive interval does not use all Bc of the tokens in the first bucket, the second bucket would continue filling. Of course, the second bucket has a finite size as well, set at Be bits or tokens. If traffic shaping doesn't need Bc bits (tokens) in each interval, the second bucket will fill, with any additional extra tokens wasted—in other words, you can only save up Be worth of "extra" tokens, because your second bucket is a set size.

So, the dual token bucket is similar to having two piggybanks—any saved money from each week is dumped from the first piggybank into the second piggybank, and the first piggybank is refilled with $10 each week. Continuing the analogy, the Mom and Dad in our scenario would also monitor the second piggybank so that it does not get too full.

Traffic shaping uses the Be so that more than Bc can be sent after a period of low activity. Traffic shaping can spend the tokens in the first bucket, and try to take the next packet, finding it does not have enough tokens in the first bucket. Because a Be has been configured, traffic shaping looks in the second token bucket, and takes enough tokens from there to buy the right to send the next packet. In fact, in a single interval, all of Bc and Be can be consumed. Before Be can be used again, traffic shaping would need some intervals with less than Bc traffic, so that the unused tokens from some intervals could be used to refill the second bucket.

Figure 5-8 shows a graph of how shaping works when using Be. The shaper represented by the graph shapes to a CIR of 64 kbps, over a 128-kbps link. The Bc has been set to 8000 bits, with an additional 8000 bits for Be.

Figure 5-8 Bc and Be, After a Period of Inactivity (Both Buckets Are Full)

Figure 5-8 Bc and Be, After a Period of Inactivity (Both Buckets Are Full)

0 125 250 375 500 625 750 875 1000

0 125 250 375 500 625 750 875 1000

This example assumes that enough inactive or slow periods have occurred, just prior to this example, so that Be has 8000 bits in it. In other words, the second token bucket holds 8000 tokens, each representing a bit. A large amount of traffic shows up, so traffic shaping sends as fast as it can for several consecutive time intervals. In the first interval, traffic shaping can send a total of 16,000 bits, because the actual Bc at the start of the interval is 8000, and the actual Be at the start of the first interval is also 8000 bits. On a 128-kbps link, over the default 125-ms Tc, it takes all 125 ms to send 16,000 bits! Effectively, in this particular case, after a period of inactivity, R1 sends continuously for 187.5 ms until traffic shaping artificially slows down the traffic. Thus, the goal of allowing a burst of data traffic to get started quickly is accomplished with Be.

Advance SEO Techniques

Advance SEO Techniques

Turbocharge Your Traffic And Profits On Auto-Pilot. Would you like to watch visitors flood into your websites by the 1,000s, without expensive advertising or promotions? The fact is, there ARE people with websites doing exactly that right now. How is that possible, you ask? The answer is Advanced SEO Techniques.

Get My Free Ebook


Post a comment