Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
What is Congestion Control Algorithm?
Congestion control is a critical mechanism in computer networks that prevents network performance degradation when too many packets traverse the communication medium. When the number of packets exceeds the network's capacity, delays increase significantly beyond normal propagation delays, creating a congested state.
There are two primary congestion control algorithms used in network traffic management:
Leaky Bucket Algorithm
The leaky bucket algorithm is a traffic shaping technique that controls the rate at which data is injected into a network. It smooths bursty traffic into a steady stream by enforcing a constant output rate regardless of input variations.
How It Works
The algorithm models a bucket with capacity b bytes and a hole at the bottom that leaks at a constant rate of r bytes per second. When packets arrive:
-
If packet size ? available bucket space, the packet is accepted
-
If packet size > available space, it is either dropped or queued
-
Output flows at constant rate r when bucket contains data, zero when empty
Disadvantage: The fixed leak rate leads to inefficient use of network resources during low-traffic periods, as available bandwidth remains unused.
Token Bucket Algorithm
The token bucket algorithm provides more flexibility than the leaky bucket by allowing controlled bursts while maintaining average rate limits. It uses tokens to grant transmission permission for packets.
How It Works
Tokens are added to the bucket at rate 1/r seconds per token, up to bucket capacity b tokens. For packet transmission:
-
Each token represents permission to send a predetermined packet size
-
For an n-byte packet, n tokens are consumed from the bucket
-
If sufficient tokens exist, the packet is transmitted (conformant)
-
If insufficient tokens, the packet is dropped, queued, or marked non-conformant
Advantage: Allows burst transmission up to bucket capacity while maintaining average rate control, providing better network resource utilization.
Comparison
| Feature | Leaky Bucket | Token Bucket |
|---|---|---|
| Output Rate | Fixed constant rate | Variable up to peak rate |
| Burst Handling | Smooths all bursts | Allows controlled bursts |
| Resource Utilization | Poor during low traffic | Better overall utilization |
| Flexibility | Rigid | More flexible |
Conclusion
Congestion control algorithms like leaky bucket and token bucket are essential for managing network traffic flow. While leaky bucket provides smooth, constant output, token bucket offers better flexibility and resource utilization by allowing controlled bursts.
