Traffic Shaping, Traffic Policing

Peter Puschner, Institut für Technische Informatik , Traffic Policing

• Enforce compliance of traffic to a given traffic profile (e.g., rate limiting) • By delaying or dropping certain packets, one can (i) optimize or guarantee performance, (ii) improve latency, and/or (iii) increase or guarantee for other packets • Traffic shaping: delays non-conforming traffic • Traffic policing: drops or marks non-conforming traffic

Peter Puschner, TU Wien 2 Traffic Shaping

• Traffic metering to check compliance of packets with traffic contract e.g., leaky bucket / algorithm • Imposes limits on bandwidth and burstiness • Buffering of packets that arrive early – Buffer dimensioning (?) • Strategy to deal with full buffer – Tail drop (à policing) – Random Early Discard – Unshaped forwarding of overflow traffic

Peter Puschner, TU Wien 3 Traffic Shaping

• Self limiting sources • Shaping by network switches

• Shaping traffic uniformly by rate • More sophisticated characteristics (allow for defined variability in traffic)

Peter Puschner, TU Wien 4 Token Bucket Algorithm

• Bucket capacity: C [tokens] • Token arrival rate: r [tokens per second] • When a packet of n bytes arrives, n tokens are removed from the bucket and the packet is sent • If fewer than n tokens available, no token is removed and the packet is considered to be non-conformant

Peter Puschner, TU Wien 5 Leaky Bucket Algorithm

n n n C C

r … leak rate

Peter Puschner, TU Wien 6 Leaky Bucket Algorithm

n • Bucketn with capacity C leaks at fixedn rate r • TheC bucket must never overflow C • If the bucket is empty it stops leaking • A packet is conformant, if the amount of water, n, can be added to the bucketr … leak without rate causing an overflow; n is either constant or proportional to packet size • For non-conformant packets, no water is added to the bucket

Peter Puschner, TU Wien 7 Leaky Bucket Properties

Best average rate (over infinite time) r [bytes/s]

r /n [messages/s], with message size n bytes Maximum burst size assume max. transmission rate M [bytes/s] C if r < M T = M – r max ∞ otherwise

Lmax = Tmax × M [bytes] msg Lmax = ( Tmax × M ) / n [messages]

Peter Puschner, TU Wien 8 Leaky Bucket - Notes

C – n … characterizes max. tolerance “how early can a packet be sent?” C = n … minimum message-send interval: n/r

r / n … maximum rate at which packets can conform once the bucket is full The bucket stops leaking when it is empty à this limits the tolerance accrual in times when the incoming traffic rate is low C, r, n, queue size determine outgoing traffic

Peter Puschner, TU Wien 9 Leaky Bucket – Remark

Strategy can be used to measure rate of any e.g., detect when an event rate increases above some acceptable threshold (bucket overflow) Different use of leaky-bucket counter on overflow condition • Unbounded increment to penalize overload cond. • No increment when bucket is full à allows to detect when situation is back to normal

Peter Puschner, TU Wien 10 Summary

• Strategies to enforce compliance of traffic to a given profile – Traffic Shaping: delays non-conforming traffic – Traffic Policing: drops/marks non-conforming traffic • Who does the shaping? – Sender: to guarantee that network accepts traffic – Network switches: to enforce contract compliance • What is controlled? – Rate, jitter, burstiness

Peter Puschner, TU Wien 11