Leaky Bucket Algorithm: 171FA04014 171FA04042 171FA04276

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 22

LEAKY BUCKET

ALGORITHM

171FA04014
171FA04042
171FA04276
CONTENTS:
Congestion
Traffic Shopping
Introduction
Algorithm Example
Uses
Advantages & Disadvantages
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
packet at a higher rate than receiving nodes are removing them.
This degrades the performance , and such a situation is termed as
Congestion.
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.
Introduction
Conceptually , each host connected to the network has an
interface containing a “Leaky Bucket”(a queue)
To send a packet into a 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.
Continued…..
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.
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 the packet.

Step-3:Reset the counter and go to step-1.


Example :
Let n=1000

Packet= 200 700 500 540 400 200

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
Packet =

Now Again n>front of the queue i.e. n > 400


Therefore, n=800-400=400
Packet size of 400 is sent to the network.
Packet = 200 700 500 450

Since n< front of queue


Therefore, the procedure is stop.
Initialize n=1000 on another tick of clock.
This procedure is repeated until all the packets are sent to the
network.
Explanation
When the packets are all of 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 an the tick , two 512-byte packets ,
four 256-byte packets , and so on.
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)


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.
Leaky bucket model
However , the input rate can vary around R without over
floating 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”.


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
accumulates in the bucket.
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 burst traffic
Leaky bucket algorithm is used as the mechanism of the
UPC(Usage Parameter Control)in the network.
Advantages
Token independent.
Packets are transmitted continuously.
It send the packet at constant rate .
Input rate can differ but output rate will be constant.
Disadvantages
It does not save token.
If bucket is full packet or data is discarded.
LB sends packets at an average rate.

You might also like