Leaky bucket A

22
Group members: Aqsa Imtiaz Zainab Tariq Shaheer Ali Huda Naseer 1

Transcript of Leaky bucket A

Page 1: Leaky bucket A

1

Group members: Aqsa Imtiaz

Zainab Tariq

Shaheer Ali

Huda Naseer

Page 2: Leaky bucket A

2

TOPIC: LEAKY BUCKET ALGORITHM

Page 3: Leaky bucket A

3

Outlines: Congestion Traffic Shaping Introduction Algorithm Example Uses Advantages & Disadvantages

Page 4: Leaky bucket A

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.

Page 5: Leaky bucket A

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

Page 6: Leaky bucket A

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.

Page 7: Leaky bucket A

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:

Page 8: Leaky bucket A

8

Figure:

(a) A leaky bucket with water. (b) a leaky bucket with packets.

Page 9: Leaky bucket A

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.

Page 10: Leaky bucket A

10

Example

Let n = 1000

Packet =.

Since n > front of Queue i.e. n>200Therefore, n= 1000-200 = 800Packet size of 200 is sent to the network

200 700 500 450 400 200

Page 11: Leaky bucket A

11

Packet =

Now Again n > front of queue i.e. n > 400Therefore, n= 800-400 = 400Packet size of 400 is sent to the network

Page 12: Leaky bucket A

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.

Page 13: Leaky bucket A

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.

Page 14: Leaky bucket A

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)

Page 15: Leaky bucket A

15

Page 16: Leaky bucket A

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.

Page 17: Leaky bucket A

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.

Page 18: Leaky bucket A

18

ParametersThe 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.

Page 19: Leaky bucket A

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.

Page 20: Leaky bucket A

20

Advantages:

Token independentPackets are transmitted continuously.It sends the packet at constant rateInput rate can differ but output rate will be constant.

Page 21: Leaky bucket A

Disadvantages

It does not save token.If bucket is full packet or data is discarded.LB sends packets at an average rate.

21

Page 22: Leaky bucket A

Thank You

22