SlideShare a Scribd company logo
1

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
2

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.

•

In this algorithm the input rate can vary but the output rate remains constant.

•

This algorithm saves busty traffic into fixed rate traffic by averaging the data rate.
3
The Leaky Bucket Algorithm

(a) A leaky bucket with water.

(b) a leaky bucket with packets.
4

Leaky Bucket Algorithm
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.
5
Example
Let n = 1000
Packet =. 200

700

500

450

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

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

700

500

450

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.
6
Leaky Bucket Algorithm

Example
Consider a frame relay network having a capacity of 1Mb and data is input at the rate of 25mbps.Calculate
1. What is the time needed to fill the bucket.
2. If the output rate is 2 mbps , the time needed to empty the bucket.
Ans.
Here ,
C is Capacity of bucket = 1mb
Data input rate = 25 mbps
output rate = 2mbps.
1.

T = C/input rate

= 1/25

= 40 msec

2

T = C/output rate

= ½

= 500 msec
7

Token Bucket Algorithm

•

The Token Bucket Algorithm compare to Leaky Bucket Algorithm allow the output rate vary
depending on the size of burst.

•

In this algorithm the buckets holds token to transmit a packet, the host must capture and destroy
one token.

•

Tokens are generated by a clock at the rate of one token every t sec.

•

Idle hosts can capture and save up tokens (up to the max. size of the bucket) in order to send
larger bursts later.
8
Token Bucket Algorithm

5-34

(a) Before

(b) After
9

Token Bucket Algorithm
Algorithm

Step - 1 : A token is added at every ∆t time.
Step - 2 : The bucket can hold at most b-tokens. If a token arrive when bucket is full it is discarded.
Step - 3 : When a packet of m bytes arrived m tokens are removed from the bucket and the packet is sent to
the network.
Step – 4 : If less than n tokens are available no tokens are removed from the buckets and the packet is
considered to be non conformant.
The non conformant packet may be enqueued for subsequent transmission when sufficient token have been
accumulated in the bucket.
If C is the maximum capacity of bucket and ρ is the arrival rate and M is the maximum output rate then Burst
Length S can be calculated as

C + ρS = MS
10
Token Bucket Algorithm
Example
Consider a frame relay network having a capacity of 1Mb of data is arriving at the rate of 25mbps for 40msec.The
Token arrival rate is 2mbps and the capacity of bucket is 500 kb with maximum output rate 25mbps.Calculate
1. The Burst Length.
2. Total output time.
Ans.
Here ,
C is Capacity of bucket = 500kb
M= 25 mbps
ρ = 2mbps.
1.

S= 500/((25-2)*1000) = 21.73msec ~= 22msec

2

For 22msec the output rate is 25msec after that the output rate becomes 2mbps i.e. token arrival rate.
Therefore, for another 500 kb the time taken will be.
500/(2000) = 250 msec
Therefore, total output time = 22 +250 = 272 msec.
11
DIFFERENCE BETWEEN LEAKY BUCKET AND TOKEN BUCKET ALGORITHM
TOKEN BUCKET

LEAKY BUCKET

Token dependent.

Token independent.

If bucket is full token are discarded, but not the
packet.

If bucket is full packet or data is discarded.

Packets can only transmitted when there are
enough token

Packets are transmitted continuously.

It allows large bursts to be sent faster rate after
that constant rate

It sends the packet at constant rate

It saves token to send large bursts.

It does not save token.

More Related Content

What's hot

ELEMENTS OF TRANSPORT PROTOCOL
ELEMENTS OF TRANSPORT PROTOCOLELEMENTS OF TRANSPORT PROTOCOL
ELEMENTS OF TRANSPORT PROTOCOL
Shashank Rustagi
 
Delay , Loss & Throughput
Delay , Loss & ThroughputDelay , Loss & Throughput
Delay , Loss & Throughput
Tutor in Tuition Classes
 
Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]Ravindra Raju Kolahalam
 
Distance vector routing
Distance vector routingDistance vector routing
Distance vector routing
Siddique Ibrahim
 
Computer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESS
Computer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESSComputer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESS
Computer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESS
Dr. SELVAGANESAN S
 
IEEE 802.11 Architecture and Services
IEEE 802.11 Architecture and ServicesIEEE 802.11 Architecture and Services
IEEE 802.11 Architecture and Services
Sayed Chhattan Shah
 
Stop and-wait protocol
Stop and-wait protocolStop and-wait protocol
Stop and-wait protocol
Venkata Sreeram
 
Address resolution protocol (ARP)
Address resolution protocol (ARP)Address resolution protocol (ARP)
Address resolution protocol (ARP)
NetProtocol Xpert
 
TCP and UDP
TCP and UDP TCP and UDP
TCP and UDP
Ramesh Giri
 
5. protocol layering
5. protocol layering5. protocol layering
5. protocol layering
JAIGANESH SEKAR
 
I. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHMI. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHM
vikas dhakane
 
Point To Point Protocol
Point To Point ProtocolPoint To Point Protocol
Point To Point ProtocolPhan Vuong
 
Congestion avoidance in TCP
Congestion avoidance in TCPCongestion avoidance in TCP
Congestion avoidance in TCP
selvakumar_b1985
 
Chapter 4 data link layer
Chapter 4 data link layerChapter 4 data link layer
Chapter 4 data link layer
Naiyan Noor
 
IPV4 Frame Format
IPV4 Frame FormatIPV4 Frame Format
IPV4 Frame Format
Aditya Rawat
 
TCP/ IP
TCP/ IP TCP/ IP
Ethernet
EthernetEthernet
Ethernet
sijil chacko
 
Routing algorithm
Routing algorithmRouting algorithm
Routing algorithm
Bushra M
 
Osi reference model
Osi reference modelOsi reference model
Osi reference model
vasanthimuniasamy
 

What's hot (20)

ELEMENTS OF TRANSPORT PROTOCOL
ELEMENTS OF TRANSPORT PROTOCOLELEMENTS OF TRANSPORT PROTOCOL
ELEMENTS OF TRANSPORT PROTOCOL
 
Delay , Loss & Throughput
Delay , Loss & ThroughputDelay , Loss & Throughput
Delay , Loss & Throughput
 
Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]
 
Distance vector routing
Distance vector routingDistance vector routing
Distance vector routing
 
Computer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESS
Computer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESSComputer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESS
Computer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESS
 
IEEE 802.11 Architecture and Services
IEEE 802.11 Architecture and ServicesIEEE 802.11 Architecture and Services
IEEE 802.11 Architecture and Services
 
Stop and-wait protocol
Stop and-wait protocolStop and-wait protocol
Stop and-wait protocol
 
Address resolution protocol (ARP)
Address resolution protocol (ARP)Address resolution protocol (ARP)
Address resolution protocol (ARP)
 
TCP and UDP
TCP and UDP TCP and UDP
TCP and UDP
 
5. protocol layering
5. protocol layering5. protocol layering
5. protocol layering
 
Quality of Service
Quality of ServiceQuality of Service
Quality of Service
 
I. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHMI. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHM
 
Point To Point Protocol
Point To Point ProtocolPoint To Point Protocol
Point To Point Protocol
 
Congestion avoidance in TCP
Congestion avoidance in TCPCongestion avoidance in TCP
Congestion avoidance in TCP
 
Chapter 4 data link layer
Chapter 4 data link layerChapter 4 data link layer
Chapter 4 data link layer
 
IPV4 Frame Format
IPV4 Frame FormatIPV4 Frame Format
IPV4 Frame Format
 
TCP/ IP
TCP/ IP TCP/ IP
TCP/ IP
 
Ethernet
EthernetEthernet
Ethernet
 
Routing algorithm
Routing algorithmRouting algorithm
Routing algorithm
 
Osi reference model
Osi reference modelOsi reference model
Osi reference model
 

Similar to Leaky Bucket & Tocken Bucket - Traffic shaping

Leaky bucket A
Leaky bucket ALeaky bucket A
Leaky bucket A
Syed Shaheer Gilani
 
Congestion control algorithms.pptx
Congestion control algorithms.pptxCongestion control algorithms.pptx
Congestion control algorithms.pptx
ujjwalmatoliya
 
Congestion control
Congestion controlCongestion control
Congestion control
Nithin Raj
 
Part9-congestion.pptx
Part9-congestion.pptxPart9-congestion.pptx
Part9-congestion.pptx
Olivier Bonaventure
 
9_Network.ppt
9_Network.ppt9_Network.ppt
9_Network.ppt
SushmaShivani
 
congestion ujjwal matoliya.pptx
congestion ujjwal matoliya.pptxcongestion ujjwal matoliya.pptx
congestion ujjwal matoliya.pptx
ujjwalmatoliya
 
RIPE 80: Buffers and Protocols
RIPE 80: Buffers and ProtocolsRIPE 80: Buffers and Protocols
RIPE 80: Buffers and Protocols
APNIC
 
Conjestion control
Conjestion controlConjestion control
Conjestion control
Barani Tharan
 
Example problems
Example problemsExample problems
Example problems
deepakps22
 
Switching Problems.pdf
Switching Problems.pdfSwitching Problems.pdf
Switching Problems.pdf
Senthil Vit
 
Congestion control 1
Congestion control 1Congestion control 1
Congestion control 1
Aman Jaiswal
 
CN Module 5 part 2 2022.pdf
CN Module 5 part 2 2022.pdfCN Module 5 part 2 2022.pdf
CN Module 5 part 2 2022.pdf
MayankRaj687571
 
Tcp Congestion Avoidance
Tcp Congestion AvoidanceTcp Congestion Avoidance
Tcp Congestion Avoidance
Ram Dutt Shukla
 
QoSintro.PPT
QoSintro.PPTQoSintro.PPT
QoSintro.PPT
payal445263
 
Availability Computer Communication Network .pdf
Availability Computer Communication Network .pdfAvailability Computer Communication Network .pdf
Availability Computer Communication Network .pdf
YashShirude1
 
NZNOG 2020: Buffers, Buffer Bloat and BBR
NZNOG 2020: Buffers, Buffer Bloat and BBRNZNOG 2020: Buffers, Buffer Bloat and BBR
NZNOG 2020: Buffers, Buffer Bloat and BBR
APNIC
 
Transmission
TransmissionTransmission
Transmissionmrhaken
 
Quality of service
Quality of serviceQuality of service
Quality of service
Ismail Mukiibi
 
Computer Networks Module 2.pdf
Computer Networks Module 2.pdfComputer Networks Module 2.pdf
Computer Networks Module 2.pdf
ShanthalaKV
 
Qo s metrics
Qo s metricsQo s metrics
Qo s metricswael-b1
 

Similar to Leaky Bucket & Tocken Bucket - Traffic shaping (20)

Leaky bucket A
Leaky bucket ALeaky bucket A
Leaky bucket A
 
Congestion control algorithms.pptx
Congestion control algorithms.pptxCongestion control algorithms.pptx
Congestion control algorithms.pptx
 
Congestion control
Congestion controlCongestion control
Congestion control
 
Part9-congestion.pptx
Part9-congestion.pptxPart9-congestion.pptx
Part9-congestion.pptx
 
9_Network.ppt
9_Network.ppt9_Network.ppt
9_Network.ppt
 
congestion ujjwal matoliya.pptx
congestion ujjwal matoliya.pptxcongestion ujjwal matoliya.pptx
congestion ujjwal matoliya.pptx
 
RIPE 80: Buffers and Protocols
RIPE 80: Buffers and ProtocolsRIPE 80: Buffers and Protocols
RIPE 80: Buffers and Protocols
 
Conjestion control
Conjestion controlConjestion control
Conjestion control
 
Example problems
Example problemsExample problems
Example problems
 
Switching Problems.pdf
Switching Problems.pdfSwitching Problems.pdf
Switching Problems.pdf
 
Congestion control 1
Congestion control 1Congestion control 1
Congestion control 1
 
CN Module 5 part 2 2022.pdf
CN Module 5 part 2 2022.pdfCN Module 5 part 2 2022.pdf
CN Module 5 part 2 2022.pdf
 
Tcp Congestion Avoidance
Tcp Congestion AvoidanceTcp Congestion Avoidance
Tcp Congestion Avoidance
 
QoSintro.PPT
QoSintro.PPTQoSintro.PPT
QoSintro.PPT
 
Availability Computer Communication Network .pdf
Availability Computer Communication Network .pdfAvailability Computer Communication Network .pdf
Availability Computer Communication Network .pdf
 
NZNOG 2020: Buffers, Buffer Bloat and BBR
NZNOG 2020: Buffers, Buffer Bloat and BBRNZNOG 2020: Buffers, Buffer Bloat and BBR
NZNOG 2020: Buffers, Buffer Bloat and BBR
 
Transmission
TransmissionTransmission
Transmission
 
Quality of service
Quality of serviceQuality of service
Quality of service
 
Computer Networks Module 2.pdf
Computer Networks Module 2.pdfComputer Networks Module 2.pdf
Computer Networks Module 2.pdf
 
Qo s metrics
Qo s metricsQo s metrics
Qo s metrics
 

Recently uploaded

Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
Steve Thomason
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
Fundacja Rozwoju Społeczeństwa Przedsiębiorczego
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 

Recently uploaded (20)

Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 

Leaky Bucket & Tocken Bucket - Traffic shaping

  • 1. 1 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
  • 2. 2 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. • In this algorithm the input rate can vary but the output rate remains constant. • This algorithm saves busty traffic into fixed rate traffic by averaging the data rate.
  • 3. 3 The Leaky Bucket Algorithm (a) A leaky bucket with water. (b) a leaky bucket with packets.
  • 4. 4 Leaky Bucket Algorithm 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.
  • 5. 5 Example Let n = 1000 Packet =. 200 700 500 450 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 Now Again n > front of queue i.e. n > 400 Therefore, n= 800-400 = 400 Packet size of 400 is sent to the network 200 700 500 450 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.
  • 6. 6 Leaky Bucket Algorithm Example Consider a frame relay network having a capacity of 1Mb and data is input at the rate of 25mbps.Calculate 1. What is the time needed to fill the bucket. 2. If the output rate is 2 mbps , the time needed to empty the bucket. Ans. Here , C is Capacity of bucket = 1mb Data input rate = 25 mbps output rate = 2mbps. 1. T = C/input rate = 1/25 = 40 msec 2 T = C/output rate = ½ = 500 msec
  • 7. 7 Token Bucket Algorithm • The Token Bucket Algorithm compare to Leaky Bucket Algorithm allow the output rate vary depending on the size of burst. • In this algorithm the buckets holds token to transmit a packet, the host must capture and destroy one token. • Tokens are generated by a clock at the rate of one token every t sec. • Idle hosts can capture and save up tokens (up to the max. size of the bucket) in order to send larger bursts later.
  • 9. 9 Token Bucket Algorithm Algorithm Step - 1 : A token is added at every ∆t time. Step - 2 : The bucket can hold at most b-tokens. If a token arrive when bucket is full it is discarded. Step - 3 : When a packet of m bytes arrived m tokens are removed from the bucket and the packet is sent to the network. Step – 4 : If less than n tokens are available no tokens are removed from the buckets and the packet is considered to be non conformant. The non conformant packet may be enqueued for subsequent transmission when sufficient token have been accumulated in the bucket. If C is the maximum capacity of bucket and ρ is the arrival rate and M is the maximum output rate then Burst Length S can be calculated as C + ρS = MS
  • 10. 10 Token Bucket Algorithm Example Consider a frame relay network having a capacity of 1Mb of data is arriving at the rate of 25mbps for 40msec.The Token arrival rate is 2mbps and the capacity of bucket is 500 kb with maximum output rate 25mbps.Calculate 1. The Burst Length. 2. Total output time. Ans. Here , C is Capacity of bucket = 500kb M= 25 mbps ρ = 2mbps. 1. S= 500/((25-2)*1000) = 21.73msec ~= 22msec 2 For 22msec the output rate is 25msec after that the output rate becomes 2mbps i.e. token arrival rate. Therefore, for another 500 kb the time taken will be. 500/(2000) = 250 msec Therefore, total output time = 22 +250 = 272 msec.
  • 11. 11 DIFFERENCE BETWEEN LEAKY BUCKET AND TOKEN BUCKET ALGORITHM TOKEN BUCKET LEAKY BUCKET Token dependent. Token independent. If bucket is full token are discarded, but not the packet. If bucket is full packet or data is discarded. Packets can only transmitted when there are enough token Packets are transmitted continuously. It allows large bursts to be sent faster rate after that constant rate It sends the packet at constant rate It saves token to send large bursts. It does not save token.