Unit3 Congestion Control
Unit3 Congestion Control
20
The Leaky Bucket Algorithm
• The Leaky Bucket Algorithm used to control rate in a
network. It is implemented as a single-server queue with
constant service time. If the bucket (buffer) overflows then
packets are discarded.
• The leaky bucket enforces a constant output rate (average
rate) regardless of the burstiness of the input. Does nothing
when input is idle.
• The host injects one packet per clock tick onto the network.
• This results in a uniform flow of packets, smoothing out
bursts and reducing congestion.
21
The Leaky Bucket Algorithm
(a) A leaky bucket with water. (b) a leaky bucket with packets.
22
• When packets are the same size (as in ATM cells), the one
packet per tick is okay. For variable length packets though, it
is better to allow a fixed number of bytes per tick. E.g. 1024
bytes per tick will allow one 1024-byte packet or two 512-
byte packets or four 256-byte packets on 1 tick.
23
Leaky Bucket Traffic Shaper
Size N
Incoming traffic Shaped traffic
Ser
ver
Packet
32
The Token Bucket Algorithm
5-
34
Size N
Incoming traffic Shaped traffic
Server
Packet
•Token rate regulates transfer of packets
•If sufficient tokens available, packets enter network without delay
•K determines how much burstiness allowed into the network
Leaky Bucket vs Token Bucket
29
Advantage of token Bucket over leaky bucket
29
Load Shedding
• When buffers become full, routers simply discard packets.
• Which packet is chosen to be the victim depends on the
application and on the error strategy used in the data link
layer.
• For a file transfer, for, e.g. cannot discard older packets since
this will cause a gap in the received data.
•For real-time voice or video it is probably better to throw
away old data and keep new packets.
• Get the application to mark packets with discard priority.
30