200 likes | 258 Views
Introduction to Traffic Shaping. Traffic Regulation. Traffic regulation ( or traffic conditioning) refers to mechanisms to enforce that traffic from a flow or a group of flows adheres to a given specification Policing Drop traffic that violates the specification Shaping
E N D
Introduction to Traffic Shaping ECE 1545
Traffic Regulation • Traffic regulation (or traffic conditioning) refers to mechanisms to enforce that traffic from a flow or a group of flows adheres to a given specification • Policing Drop traffic that violates the specification • Shaping Buffer traffic at network entrance that violates specification • Marking Mark packets with a lower priority, if traffic specification is violated
Traffic Regulation • Traffic regulation can be used to … • … reduce the burstiness of a flow (output is smoother than input) • … enforce a limit on the amount of traffic that be sent by a flow Traffic Regulator Traffic • Traffic regulation is typically done at the network edge
Traffic Specification Burst size: Max. amount of data that can be sent at any timeRate: long-term average rate Traffic Rate r Burst sizeb Time interval
Traffic Specification Burst size: Max. amount of data that can be sent at any timeRate: long-term average rate Peak rate: short-term maximum rate Traffic Rate r Burst sizeb Peak rate P Time interval
Traffic Specification Average rate r Burst sizeb Peak rate P Time interval
Token Bucket Token Bucket is a traffic regulation mechanism that enforces a maximum burst size b and a maximum average rate of r • Tokens are added at rate r up to a maximum size of b
Token Bucket • Assume: Packet can depart if enough tokens are available. • Tokens are removed tokens when packet departs (Here: 10 tokens are needed)
Token Bucket • Assume: Packet removes 10 tokens from buffer • (Number of tokens is associated with packet size)
Token Bucket • Packet must wait until enough tokens are available
Token Bucket (fluid flow version) b • For an analysis it is convenient to work with a fluid flow version of the token bucket (Traffic can depart in arbitrarily small chunks)
TB = b = 2r = 1 A+TB-B
Dual Token Bucket A Dual Token Bucket additionally enforces a peak rate P • To depart, a packet must draw tokens from both buckets
Implementation in Assignment 1 TokenBucket
Token Bucket in Assignment 1 TokenBucketReceiver (BR) TokenBucketSender (BS) If (buffer_is_not_empty) if (enough_tokens) consume tokens; sendingInProgress = true; remove packet from buffer; send packet; sendingInProgress = false; else get expected time when there will be enough tokens; sleep for this time; else wait for packet to arrive to buffer; if (buffer_is_empty && not(sendingInProgress) &&enough_tokens_available) consume tokens; send packet; else add packet to buffer;
Alternative implementation for Token Bucket Idea: instead of counting tokens (and compute timestamps from tokens), work directly with timestamps VC : release time of packet (init: VC = 0) l : packet size now : current timeTDTp: Target departure time of packet p b TokenBucketReceiver (BR) TokenBucketSender (BS) If (buffer_is_not_empty) if (TDThead_of_buffer ≤ now) sendingInProgress = true; remove packet from buffer; send packet; sendingInProgress = false; else sleep for now - TDThead_of_buffer ; else wait for packet to arrive to buffer; VC = max {VC, now} + l/r; if ( buffer_is_empty && not(sendingInProgress) && VC - b/r ≤ now ) send packet; else Set TDTp = VC - b/r; add packet to buffer;
Peak Rate Constrained Token Bucket • Adds a constraint on the maximum (“peak”) rate of traffic: • Is implemented with 2 token buckets in series. Traffic Slope r b Slope P Time interval