Download presentation
Presentation is loading. Please wait.
1
Introduction to Traffic Shaping
ECE 1545
2
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
3
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
4
Traffic Specification
Burst size: Max. amount of data that can be sent at any time Rate: long-term average rate Traffic Rate r Burst size b Time interval
5
Traffic Specification
Burst size: Max. amount of data that can be sent at any time Rate: long-term average rate Peak rate: short-term maximum rate Traffic Rate r Burst size b Peak rate P Time interval
6
Traffic Specification
Average rate r Burst size b Peak rate P Time interval
7
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
8
Token Bucket Assume: Packet can depart if enough tokens are available.
Tokens are removed tokens when packet departs (Here: 10 tokens are needed)
9
Token Bucket Assume: Packet removes 10 tokens from buffer
(Number of tokens is associated with packet size)
10
Token Bucket Packet must wait until enough tokens are available
11
Token Bucket (fluid flow version)
For an analysis it is convenient to work with a fluid flow version of the token bucket (Traffic can depart in arbitrarily small chunks)
12
TB = b = 2 r = 1
13
TB = b = 2 r = 1 A+TB-B
14
Dual Token Bucket A Dual Token Bucket additionally enforces a peak rate P To depart, a packet must draw tokens from both buckets
15
Implementation
16
Implementation in Assignment 1
TokenBucket
17
Token Bucket in Assignment 1
TokenBucketReceiver (BR) TokenBucketSender (BS) if (buffer_is_empty && not(sendingInProgress) && enough_tokens_available) consume tokens; send packet; else add packet to buffer; 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; wait for packet to arrive to buffer;
18
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 time TDTp : Target departure time of packet p b TokenBucketSender (BS) TokenBucketReceiver (BR) 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 ; 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;
19
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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.