![]() |
VOOZH | about |
In computer networks, congestion occurs when too much data is sent through the network at the same time, causing delays, packet loss, or even network collapse. This is similar to a traffic jam on a highway - when too many cars try to move at once, everything slows down.
Congestion control is the set of techniques and mechanisms used to prevent, detect, and manage congestion. Its main goal is to maintain smooth data flow, fair bandwidth allocation, and efficient utilization of network resources, ensuring a stable and reliable network performance.
The leaky bucket algorithm controls the flow of packets by sending them out at a constant, fixed rate, regardless of incoming burst traffic. Packets are placed into a bucket (queue), and if the bucket overflows, excess packets are discarded. This ensures smooth traffic but wastes bandwidth during idle times.
Steps:
Limitation: Too rigid, wastes available bandwidth if traffic is bursty.
The token bucket algorithm allows more flexibility by generating tokens at a fixed rate. A packet can only be transmitted if a token is available, and each packet consumes one token. If enough tokens accumulate, burst traffic can be sent quickly, making it better for handling variable traffic patterns without unnecessary drops.
Steps:
Advantage: Handles bursty traffic efficiently without unnecessary data loss.
| Parameter | Leaky Bucket | Token Bucket |
|---|---|---|
| Output | Fixed, constant rate | Variable, allows bursts |
| Flexibility | Rigid | Flexible |
| Packet Loss | Possible during bursts | Avoids loss if tokens available |
Need of Token Bucket: The leaky bucket algorithm enforces output pattern at the average rate, no matter how bursty the traffic is. So in order to deal with the bursty traffic we need a flexible algorithm so that the data is not lost.