SlideShare une entreprise Scribd logo
1  sur  11
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.

Contenu connexe

Tendances

Routing algorithm
Routing algorithmRouting algorithm
Routing algorithmBushra M
 
Communication primitives
Communication primitivesCommunication primitives
Communication primitivesStudent
 
QOS (Quality of Services) - Computer Networks
 QOS (Quality of Services) - Computer Networks QOS (Quality of Services) - Computer Networks
QOS (Quality of Services) - Computer NetworksIIIT Manipur
 
Network Layer,Computer Networks
Network Layer,Computer NetworksNetwork Layer,Computer Networks
Network Layer,Computer Networksguesta81d4b
 
Error Detection And Correction
Error Detection And CorrectionError Detection And Correction
Error Detection And CorrectionRenu Kewalramani
 
IEEE 802.11 Architecture and Services
IEEE 802.11 Architecture and ServicesIEEE 802.11 Architecture and Services
IEEE 802.11 Architecture and ServicesSayed Chhattan Shah
 
Architecture of Mobile Computing
Architecture of Mobile ComputingArchitecture of Mobile Computing
Architecture of Mobile ComputingJAINIK PATEL
 
Network Layer design Issues.pptx
Network Layer design Issues.pptxNetwork Layer design Issues.pptx
Network Layer design Issues.pptxAcad
 
Unit 1 architecture of distributed systems
Unit 1 architecture of distributed systemsUnit 1 architecture of distributed systems
Unit 1 architecture of distributed systemskaran2190
 
Chapter 4 data link layer
Chapter 4 data link layerChapter 4 data link layer
Chapter 4 data link layerNaiyan Noor
 
Mac protocols
Mac protocolsMac protocols
Mac protocolsjuno susi
 
Fault tolerance in distributed systems
Fault tolerance in distributed systemsFault tolerance in distributed systems
Fault tolerance in distributed systemssumitjain2013
 

Tendances (20)

Application Layer
Application Layer Application Layer
Application Layer
 
Routing algorithm
Routing algorithmRouting algorithm
Routing algorithm
 
Framing in data link layer
Framing in data link layerFraming in data link layer
Framing in data link layer
 
Communication primitives
Communication primitivesCommunication primitives
Communication primitives
 
Ethernet
EthernetEthernet
Ethernet
 
Dempster shafer theory
Dempster shafer theoryDempster shafer theory
Dempster shafer theory
 
Transport layer
Transport layer Transport layer
Transport layer
 
QOS (Quality of Services) - Computer Networks
 QOS (Quality of Services) - Computer Networks QOS (Quality of Services) - Computer Networks
QOS (Quality of Services) - Computer Networks
 
Network Layer,Computer Networks
Network Layer,Computer NetworksNetwork Layer,Computer Networks
Network Layer,Computer Networks
 
Leaky bucket A
Leaky bucket ALeaky bucket A
Leaky bucket A
 
Error Detection And Correction
Error Detection And CorrectionError Detection And Correction
Error Detection And Correction
 
IEEE 802.11 Architecture and Services
IEEE 802.11 Architecture and ServicesIEEE 802.11 Architecture and Services
IEEE 802.11 Architecture and Services
 
Architecture of Mobile Computing
Architecture of Mobile ComputingArchitecture of Mobile Computing
Architecture of Mobile Computing
 
Network Layer design Issues.pptx
Network Layer design Issues.pptxNetwork Layer design Issues.pptx
Network Layer design Issues.pptx
 
5. protocol layering
5. protocol layering5. protocol layering
5. protocol layering
 
Unit 1 architecture of distributed systems
Unit 1 architecture of distributed systemsUnit 1 architecture of distributed systems
Unit 1 architecture of distributed systems
 
Issues in Data Link Layer
Issues in Data Link LayerIssues in Data Link Layer
Issues in Data Link Layer
 
Chapter 4 data link layer
Chapter 4 data link layerChapter 4 data link layer
Chapter 4 data link layer
 
Mac protocols
Mac protocolsMac protocols
Mac protocols
 
Fault tolerance in distributed systems
Fault tolerance in distributed systemsFault tolerance in distributed systems
Fault tolerance in distributed systems
 

Similaire à Leaky Bucket & Tocken Bucket - Traffic shaping

Congestion control algorithms.pptx
Congestion control algorithms.pptxCongestion control algorithms.pptx
Congestion control algorithms.pptxujjwalmatoliya
 
Congestion control
Congestion controlCongestion control
Congestion controlNithin Raj
 
congestion ujjwal matoliya.pptx
congestion ujjwal matoliya.pptxcongestion ujjwal matoliya.pptx
congestion ujjwal matoliya.pptxujjwalmatoliya
 
RIPE 80: Buffers and Protocols
RIPE 80: Buffers and ProtocolsRIPE 80: Buffers and Protocols
RIPE 80: Buffers and ProtocolsAPNIC
 
Example problems
Example problemsExample problems
Example problemsdeepakps22
 
Switching Problems.pdf
Switching Problems.pdfSwitching Problems.pdf
Switching Problems.pdfSenthil Vit
 
Congestion control 1
Congestion control 1Congestion control 1
Congestion control 1Aman 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.pdfMayankRaj687571
 
Tcp Congestion Avoidance
Tcp Congestion AvoidanceTcp Congestion Avoidance
Tcp Congestion AvoidanceRam Dutt Shukla
 
Availability Computer Communication Network .pdf
Availability Computer Communication Network .pdfAvailability Computer Communication Network .pdf
Availability Computer Communication Network .pdfYashShirude1
 
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 BBRAPNIC
 
Transmission
TransmissionTransmission
Transmissionmrhaken
 
Computer Networks Module 2.pdf
Computer Networks Module 2.pdfComputer Networks Module 2.pdf
Computer Networks Module 2.pdfShanthalaKV
 
Qo s metrics
Qo s metricsQo s metrics
Qo s metricswael-b1
 

Similaire à Leaky Bucket & Tocken Bucket - Traffic shaping (20)

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
 
qos-f05 (2).ppt
qos-f05 (2).pptqos-f05 (2).ppt
qos-f05 (2).ppt
 

Dernier

TEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxTEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxruthvilladarez
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmStan Meyer
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operationalssuser3e220a
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptshraddhaparab530
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsRommel Regala
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataBabyAnnMotar
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Projectjordimapav
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 

Dernier (20)

TEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxTEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docx
 
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and Film
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operational
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World Politics
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped data
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Project
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 

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.