Congestion Control Algorithms
Congestion Control Algorithms
5-26
(a) A leaky bucket with water. (b) a leaky bucket with packets.
Traffic Shaping
The Leaky Bucket Algorithm
• Leaky bucket – no matter at what rate water
enters the bucket, the outflow is at a constant
rate, when there is any water in the bucket,
and zero when the bucket is empty.
– When the bucket is full, any additional water
entering it spills over the sides and is lost
Traffic Shaping
The Leaky Bucket Algorithm
• Conceptually, each host is connected to the
n/w by an interface containing a finite internal
queue.
• If the packet arrives at the queue when it is
full, the packet is discarded.
Traffic Shaping
The Token Bucket Algorithm
5-34
Token bucket allows some burstiness (up to the number of token the
bucket can hold)
Traffic Shaping
The Token Bucket Algorithm
• For many applications, it is better to allow the
output to speed up somewhat when large
bursts arrive, so a more flexible algorithm is
needed, preferably one that never loses data.
• Token bucket algorithm – here, the leafy bucket
holds tokens, generated by a clock at the rate of
one token every ΔT sec.
• In fig. a, the bucket holds three tokens, with 5
packets waiting to be transmitted.
Traffic Shaping
The Token Bucket Algorithm
• For a packet to be transmitted, it must
capture and destroy one token
• In fig. b, three of the five packets have gotten
through, but the other two are stuck waiting
for two more tokens to be generated.
Traffic Shaping
The Token Bucket Algorithm
• Comparison b/w leaky bucket and token bucket
algorithm
– Leafy bucket does not allow idle hosts to save
permission to send large bursts later but, Token
bucket does allow saving, upto the max. size of the
bucket, n.
– Token bucket algorithm throws away tokens when
the bucket fills up but never discards packets, but
leaky bucket algorithm discards packets when the
bucket fills up.
Traffic Shaping
The Token Bucket Algorithm
• Impl. of token bucket algorithm
– The counter is incremented by one every ΔT and
decremented by one whenever a packet is sent.
– When the counter hits zero, no packets may be
sent.
– In the byte count variant, the counter is increment
by k bytes every ΔT and decremented by the
length of each packet sent.
Flow Specification
• Traffic shaping is most effective when the
sender , receiver and subnet agree to it
• To get agreement, it is necessary to specify
the traffic pattern in a precise way.
• This agreement is called a flow specification.
• Flow specification can apply either to the
packets sent on a virtual circuit, or to a
sequence of datagrams sent between a
source and a destination.
Flow Specification
• Some of the parameters of flow specification
– Max. packet size
– Token bucket rate
– Token bucket size
– Max. transmission rate etc
Congestion Control in Virtual-Circuit
Subnets: Admission control