4. Congestion
Internet can be considered as a Queue of packets, where
transmitting nodes are constantly adding packets and some of
them (receiving nodes) are removing packets from the queue.
Consider a situation where too many packets are present in this
queue, such that constantly transmitting nodes are pouring
packets at a higher rate than receiving nodes are removing
them.
This degrades the performance, and such a situation is termed
as Congestion.
4
5. Traffic Shaping
It is about regulating average rate of data flow.
It is a method of congestion control by providing shape to data
flow before entering the packet into the network.
At connection set-up time, the sender and carrier negotiate a
traffic pattern (shape)
There are two types of Traffic shaping algorithm :-
1. Leaky Bucket Algorithm.
2. Token Bucket Algorithm
5
6. Introduction:
Conceptually, each host connected to the network has an
interface containing a "leaky bucket” (a queue)
To send a packet into the network, it must be possible to put
more water into the bucket.
If a packet arrives when the bucket is full, the packet must
either be queued until enough water leaks out to hold it or be
discarded.
This technique was proposed by Turner (1986) and is called
the leaky bucket algorithm.
6
7. Allow one packet per clock tick.
It is implemented as a single-server queue with constant service
time.
If the bucket (buffer) overflows then packets are discarded.
In this algorithm the input rate can vary but the output rate
remains constant.
This algorithm converts bursty traffic into fixed rate traffic by
averaging the data rate
Cont’d:
7
9. Algorithm
Step - 1 : Initialize the counter to ‘n’ at every tick of clock.
Step - 2 : If n is greater than the size of packet in the
front of queue send the packet into the network and
decrement the counter by size of packet. Repeat the
step until n is less than the size of packet.
Step - 3 : Reset the counter and go to Step - 1.
9
10. 10
Example
Let n = 1000
Packet =.
Since n > front of Queue i.e. n>200
Therefore, n= 1000-200 = 800
Packet size of 200 is sent to the network
200 700 500 450 400 200
11. 11
Packet =
Now Again n > front of queue i.e. n > 400
Therefore, n= 800-400 = 400
Packet size of 400 is sent to the network
12. 12
Packet =
Since n < front of queue .
There fore, the procedure is stop.
And we initialize n = 1000 on another tick of clock.
This procedure is repeated until all the packets is sent to the network.
13. Explanation
When the packets are all the same size (e.g., ATM
cells), this algorithm can be used as described.
when variable-sized packets are being used, it is
often better to allow a fixed number of bytes per
tick, rather than just one packet.
if the rule is 1024 bytes per tick, a single 1024-
byte packet can be admitted on a tick, two 512-
byte packets, four 256-byte packets, and so on.
13
14. Leaky bucket model
To understand the leaky bucket model, consider a
bucket with a small hole at the bottom. Three
parameters define the bucket:
The capacity (B)
The rate at which water flows out of the bucket (R)
The initial fullness of the bucket (F)
14
16. Leaky bucket model
If water is poured into the bucket at exactly rate R,
the bucket will remain at F, because the input rate
equals the output rate.
If the input rate increases while R remains constant,
the bucket accumulates water.
If the input rate is larger than R for a sustained
period, eventually the bucket overflows.
16
17. Leaky bucket model
However, the input rate can vary around R without
overflowing the bucket, as long as the average input rate does
not exceed the capacity of the bucket.
The larger the capacity, the more the input rate can vary within
a given window of time.
Real life applications are Digital Media.
17
18. Parameters
The leaky bucket algorithm uses two parameters to control
traffic flow:
Burst rate: The rate at which cells are allowed to accumulate
in the bucket, expressed in cells per second.
Average rate: The average number of cells per second that
"leak" from the hole in the bottom of the bucket and enter the
network.
For example, if the average burst rate is 10 cells per second, a
burst of 10 seconds allows 100 cells to accumulate in the
bucket.
18
19. Uses:
The leaky bucket algorithm is used in packet switched computer networks
and telecommunications networks.
The leaky bucket as a queue can only be used in shaping traffic with no
delay in the output.
It may be used within the network, as part of bandwidth management, but
is more appropriate to traffic shaping in the network.
A technique used in ATM networks that applies a sustained cell flow rate
to bursty traffic.
Leaky bucket algorithm is used as the mechanism of the UPC(Usage
Parameter Control) in the network.
19