• Home
  • Subscribe
  • Contribute Us
    • Share Your Interview Experience
  • Contact Us
  • About
    • About CSEstack
    • Campus Ambassador
  • Forum & Discus
  • Tools for Geek
  • LeaderBoard
CSEstack

What do you want to Learn Today?

  • Programming
    • Tutorial- C/C++
    • Tutorial- Django
    • Tutorial- Git
    • Tutorial- HTML & CSS
    • Tutorial- Java
    • Tutorial- MySQL
    • Tutorial- Python
    • Competitive Coding Challenges
  • CSE Subject
    • (CD) Compiler Design
    • (CN) Computer Network
    • (COA) Computer Organization & Architecture
    • (DBMS) Database Management System
    • (DS) Data Structure
    • (OS) Operating System
    • (ToA) Theory of Automata
    • (WT) Web Technology
  • Interview Questions
    • Interview Questions- Company Wise
    • Interview Questions- Coding Round
    • Interview Questions- Python
    • Interview Questions- REST API
    • Interview Questions- Web Scraping
    • Interview Questions- HR Round
    • Aptitude Preparation Guide
  • GATE 2022
  • Linux
  • Trend
    • Full Stack Development
    • Artificial Intelligence (AI)
    • BigData
    • Cloud Computing
    • Machine Learning (ML)
  • Write for Us
    • Submit Article
    • Submit Source Code or Program
    • Share Your Interview Experience
  • Tools
    • IDE
    • CV Builder
    • Other Tools …
  • Jobs

2 Famous Internet Traffic Shaping Algorithms to Prevent Congestion

Heena Rajpal/17763/0
Computer NetworkCSE Subject

What are Internet traffic shaping algorithms?

Let’s get a brief introduction to traffic shaping before musing up with two famous internet traffic shaping algorithms.

What is Traffic Shaping?

The burst nature of traffic on a network is the main cause of congestion. If the traffic is uniform, there will be no congestion. Hence, to avoid congestion, traffic control tries to solve the problem with excellent design to prevent congestion.

It tries to regulate the traffic after traffic monitoring making the traffic rate more uniform and predictable, hence avoiding congestion. Basically, traffic shaping will regulate the average rate or burst nature of data transmission.

Internet Traffic Shaping Algorithms

Internet Traffic Shaping Algorithms in Network:

There are two most famous internet traffic shaping algorithms.

Table of Contents:

  1. The Leaky Bucket Algorithm
  2. The Token Bucket Algorithm

Let us discuss them one by one.

1. The Leaky Bucket Internet Traffic Shaping Algorithms:

Imagine a leaky bucket, i.e. a bucket with a small hole at the bottom. Now imagine a faucet draining water into the bucket. The water will leak out of the bucket at a particular speed. Now increase the speed of water coming from the faucet. However, the water will still leak out of the bucket at the original speed only.

The same principle follows for the leaky bucket algorithm.

Every host in a network is having a buffer with a finite queue length. Packets coming at different speeds from different sources enter the buffer. The speed of packets going out of buffer is regulated. The buffer drains onto the subnet (Difference Between Subnetting and Supernetting) either by some packets per unit time or by some total number of bytes per unit time which is useful when packet size varies greatly.

If there are any packets put in the buffer when the buffer is full, these packets are discarded. If there are no packets in the buffer, the outflow is zero. This is nothing but a single server queuing system with a constant service time hence leading to regulated traffic.

However, the drawback of this leaky bucket algorithm is that it rigidly controls the rate to one fixed value irrespective of the speed of incoming packets. When large bursts of traffic arrive, the fixed value of the data rate of output should also be increased.

2. The Token Bucket Internet Traffic Shaping Algorithms:

It is a variant of the leaky bucket algorithm. The same procedure follows for regulation of speed. The only difference is that the bucket is filled with tokens at a certain rate.

A packet has to grab a token and destroy it to leave the bucket. Hence, packets are never lost. The packets only have to wait until a packet is available and then they leave the bucket.

This is used for the production of varying output rates since we can regulate the rate of production of tokens in accordance with the burst or speed of incoming traffic.

If the traffic is large, the speed at which tokens are produced can be increased to a particular extent so that the traffic is regulated and there is no congestion. If the traffic is intermediate or less, the rate at which tokens are produced can be reduced.

Token Bucket Performance and Formulas:

Let’s

S = burst length (seconds)
C = bucket capacity (bytes)
P = token arrival rate (bytes/sec)
M = maximum source rate (bytes/sec)

Maximum bytes sent from the token bucket during a burst is

C + P.S

Maximum bytes source can send during a burst is

M.S

Setting the two equal and solving for S

S = C / M - P

You can implement these internet traffic shaping algorithms in various programming languages like C/C++, Java…

With this article, I hope you also understand the difference between Leaky Bucket and Token Bucket algorithms.

More Read: Difference Between Physical and Logical Topology

This is all about different internet traffic shaping algorithms. Let’s discuss in the comment if you have any point.

Computer Network
Heena Rajpal
Heena Rajpal is pursuing Computer Science Engineering from Indore. She has a knack for writing and an inquisitive outlook towards Computer Science fields like Database Management Systems, Object Oriented Programming and languages like C, C++, JAVA, Python, HTML etc.

Your name can also be listed here. Got a tip? Submit it here to become an CSEstack author.

Leave a Reply Cancel reply

Computer Network

CN- How does Comp Network Work?

CN- Importance of Network Topology

CN- OSI Layer Architecture

CN- Pros and Cons of OSI Model

CN- Physical vs Logical Topology

CN- Conn-Oriented Vs Conn-less

CN- Ethernet in Detail

CN- TCP vs UDP Protocol

CN- Different Classes of IPv4 Address

CN- IPv4 Vs IPv6 Address

CN- Subnetting Vs Suppernetting

CN- Internet Traffic Shaping Algo

Online Tool

CN- IP Subnet Calculator 

© 2022 – CSEstack.org. All Rights Reserved.

  • Home
  • Subscribe
  • Contribute Us
    • Share Your Interview Experience
  • Contact Us
  • About
    • About CSEstack
    • Campus Ambassador
  • Forum & Discus
  • Tools for Geek
  • LeaderBoard