7 - Rate Limiting and Traffic Shaping Flashcards
(30 cards)
Traffic Shaping Approaches
Leaky Bucket, (r, T) Traffic Shaper, Token Bucket, Composite using all 3
Motivation for Traffic Shaping
resource control, ensure flows don’t exceed rate.
Data Traffic can be
bursty, periodic, regular
Audio traffic is
continuous, strongly periodic
Video Traffic is
continuous, bursty do to the nature of how video is compressed, periodic
The two classes of traffic
Constant Bit Rate source (CBR) - Traffic arrives at regular intervals. Packets are the same size as the arrive. Audio is this.
Variable Bit Rate (VBR) - video, data, shaped according to both an averate rate, and a peak rate. Where the average rate might be a small fraction of the peak rate. You can see that at certain times, the peak rate might well exceed the avg.
Leaky Bucket Traffic Shaping (Isochronous)
Each flow has its own bucket
Data arrives in a bucket of size beta, and drains at rate rho. rho controls the avg rate, data can arrive faster or slower into the bucket but can’t drain faster than rho. So the max avg rate that traffic can be sent is the smooth rate rho. The size of thebucket controls the max burst size that can be sent for a flow. So even though the avg rate can’t exceed rho, sometimes the sender can send at a faster rate as long as the burst isn’t exceed the bucket size. The bucket allows for periodical bursts, and the regulator ensures the avg rage doesnt exceed the drain rate. Setting a larger bucket size can allow a larger burst rate. A larger rho value can make for faster avg packet rate.
(r, T) Traffic Shaping
Traffic is dividedinto T-bit frames.
Flow can inject <= to r bits in any T-bit frame. If you want to send more than one packet of r bits, you have to wait for the next T-bit frame. This obeys the (t, T) smooth traffic shape.
In this, you can’t send a packet that’s bigger than r bits long.
Unless T is long, the max packet size may be small. So the range is limited to fixed rate flows. Variable flows must request data rates that are equal to the peak rate, and that’s wasteful.
This traffic shaper is relaxed from the simple leaky bucket bc rather than sending one packet every time unit, the flow can send a certain number of bits every time unit.
When a flow exceeds it’s rate, the excess packets in that flow are given a lower priority. If the network is heavily congested, the packets may be dropped.
Priorities might be assigned by the sender or the network. The sender’s app would mark the packets since it knows which ones are important.
Routers that mark packet priorities is called policing.
Shaping bursty traffic patterns (Token Bucket)
To shape bursty traffic, allowing for bursts but still making sure the flow doesn’t exceed an avg rate. The Token Bucket is good for this.
Tokens arrive in a bucket at rate rho, and beta is the capacity of the bucket.
Traffic can arrive at an avg rate, lambda avg, and a peak rate lambda peak. Traffic can be sent by the regulator as long as there are tokens in the bucket.
The difference between Token Bucket and Leaky Bucket
Consider sending a packet of size b that’s less than beta.
- If the token bucket is full, packet is sent, and b tokens are removed.
- if the bucket is empty, the packet must wait until b tokens drip into the bucket.
- If the bucket is partially full, then it depends. If the number of tokens in the bucket exceed b then the packet is sent immediately. Otherwise, we have to wait until there are b tokens in the bucket before we can send the packet.
Token vs Leaky Bucket Cont (Token Bucket explained)
Token Bucket
- permits burstiness, but bounds it by the rate rho.
- The bound is:
- If bucket size beta, then we know that at any interval, T, then the rat is always less than beta, that is the max number of tokens that can be accumulated in the bucket. Plus the rate at which tokens accumulate, times that interval.
- We also know that the long term rate will always be less than rho.
- No discard, or policies
- More flexible since it has additional params that we can use to configure the burst size.
- One of the limitations is that at any traffic level of length T, the flow can send beta plus T times rho tokens of data. If a network tries to plice the flows by simply measuring their traffic over intervals of length T. The flow can cheat by sending this amount of data each interval.
- Consider, for example, an interval of twice this length. If the flow can send data plus T times rho in each interval.
- Then over 2T the flow can consume 2 times betwa plus tau times rho tokens. But actually this is greater than how much the flow is actually supposed to be able to send which is beta plus 2T times rho. So policing traffic being sent by token buckets is actually rather difficult. So token buckets allow for long bursts. And if the bursta are high priority traffic, they are difficult to police and may interfere with other high priority traffic. So there’s some need to limit how long a token bucket sender can monopolize the network.
Token Bucket vs Leaky Bucket (Token Bucket more…)
- Permits burstiness, but bounds it to the rate rho.
- The bound is:
- if the bucket size, beta then we know that at any interval, T, then the rate is always less than beta, that is the max number of tokens that can be accumulated in the bucket. Plus the rate at which tokens accumulate, times that time interval.
- No discard or priority policies.
- More flexible since it has additional params that we can use to configure the burst size.
- One of the limitations is that at any traffic level of length T, the flow can simply send beta plus T time rho tokens of data. If a network tries to police the flows by simply measuring their traffic over intervals of length T. The flow can cheat by sending this amount of data in each interval.
- Consider, for example an interval of twice this length. If the flow can send beta plus T times rho in each interval. Then over 2T the flow can consume 2 times beta plus tau times rho tokens. But actually, this greater than how much the flow is at actually supposed to be able to send which is beta plus 2T times rho. So policing traffic being sent by token buckets is rather difficult. So token buckets allow for long bursts. And if the bursts are of high priority traffic, they are difficult to police and may interfere with other high priority traffic. So there’s some need to limit how long a token bucket sender can monopolize the network.
Token Bucket vs Leaky Bucket (Leaky Bucket)
- Forces the bursty traffic to be smoothed
- Implement priority policies for flows that exceed the smoothing rate.
Policing With Token Buckets
- In order to police Token buckets, a Composite Shaper is used.
- Composite Shaper: to combine a Token bucket shaper with a leaky bucket.
- The combination of the token bucket shaper with the leaky bucket shaper allow for good policing. Confirming that the flows data rate does not exceed the avg data rate allowed by the smooth leaky bucket is easy.. But the implementation is more complex since each bucket flow now requires two counters, and two timers. One timer and one counter for each bucket.
Quiz Token Bucket Shaper:
The size of the bucket (beta) is 100KB, rho is 10 packets/second, and that packets are 1KB. Assume that we are talking about an interval of 1 second. Remember that an any given interval, a flow can never send more than beta plus tau times rho bits of data. Give your answer in kilobits per second kepping in mind that 1 byte is 8 bits.
The max rate would be 100KB times 1 second plus 10 packets/second times 10KB, or 110KB, which is 880 kbs/second.
Power Boost
A traffic shaping mechanism that was first deployed in commercial broadband networks in 2006 by comcast.
- Allows a subscriber to send at a higher rate for a brief period of time. Then it shapes you back to your subscribed rate. It boosts targets spare capacity in the network for use by subscribers who don’t put a lot of load on the network.
The two types of power boost
- If the rate at which the user can achieve during the burst window is set to not exceed a particular rate, then it is a power boost.
- Otherwise, the capping/shaping is called uncapped power boost. The uncapped setting, the config is simple. The area is the power boost bucket size, the max amount of traffic that can be sent that exceeds the sustained rate. The max sustained rate is rho. If we wanted to cap the rate the sender can send during the power boost window. We simply apply a second token bucket with another value of rho. That token bucket limits the peak sending rate for power boost eligible packets to the rate rho C, where rho C is larger than rho. Remember this value of rho also affects how quickly tokens can refill the bucket so it plays a role in the max rate that can be sustained during the power boost window.
Calculating Power Boosts
if someone wants to send at rate r, that’s bigger than R that they’re supposed to be sedning at, and suppose the bucket size is beta. how long can the sender send at rate r, that exceeds the sustained rate R? In other words, whats the value of d?
- We know that the bucket size, beta, as shown in the shaaded green area is d times r minus the sustained rate R. So the sender can send at the rate r, that exceeds the sustained rate R, for beta divided by r minus R sustained.
PowerBoost Quiz - Suppose that the sustained rate that a subscriber subscribes to is ten megabits per second. But they like to burst at a rate of 15 megabits per second. Suppose the bucket size is 1 megabyte or 8 megabits. How long can the sender send at the higher rate?
We know that 1MB is 8 MegaBits, and from our previous calculation, we know that the duration should be 8 megabits, over 5 megabits per second. or 1.6 seconds.
Examples of Power Boost
The Bismarck Project at Georgia Tech, there have been measurements of Comcast power boosts in diffferent home networks. Some homes exhibit different shaping profiles. Some have a very steady pattern, whereas others have a more erratic pattern. Interestingly, you can see in some cases there appear to be 2 different tiers of higher throughput rates.
Turbo Boost Effects on Latency
It effects the latency that users receive as well as the loss rate. Even though power boost allows a user to send at a higher traffic rate, actually users may experience high latency/loss over the duration that they’re sending at a hirher rate. This is because the axis may not be able to support the higher rate. If a sender can only send at R sustained for an extended period of time but is allowed to burst at a rate r for some shorter period of time, then buffers may fill up and the resulting buffers may introduce additional delays in the network since packets are being buffered up rather than dropped. TCP senders can continue to send at higher rate,s such as little r without seeing any packet loss een though the access link may not be able to send at a higher rate. As a result, packets buffer up, and users see higher latency over the course of the power boost. To solve this problem the sender might shape its rate never to exceed the sustained rate R. If it did this, then it could avoid seeing latency. So senders who are more interested in keepign latency under control than sending bursty volumes will run a traffic shaper in frontof a power boost link. To keep the rate less than the sustained rate, r could prevent buffering.
Buffer Bloat
We previously saw the effects of power boost allowing a sender to send at a higher rate than the sustained rate. If there’s a buffer that can support the higher rate, we’ll see the buffer start filling up. But it can only drain at a sustained rate. So even if the sender can send at a faster rate for a period of time, all the packets get queued up in the buffer waiting to be sent by the router. This causes more delays. More than they would if they arrived at the front of the buffer queue. The delay the packet will see in the buffer is the amount of data in the buffer divided by the rate the rate that the buffer can drain. Large buffers can cause performance issues for media streaming. Large buffers are in home WIFI devices and even in switches and routers.
Solutions to the Buffer Bloat Problem
- Use smaller buffers, but given that we’ve already deployed our infrastructure, reducing buffer size in deployed routers, switches, home wifi devices and so forth is not reasonable. the other thing we can do is use traffic shaping methods. Shape the traffic such that traffic comming into the access link never exceeds the uplink that the ISP has provided us so the buffer doesn’t over fill.
Network Measurement
How to see traffic is being sent on the network.