What is congestion?
A state occurs in the network layer when the message traffic is so heavy that it slows down network response time.
Effects of Congestion
Congestion control algorithms
Let us consider an example to understand
Imagine a bucket with a small hole in the bottom.No matter at what rate water enters the bucket, the outflow is at a constant rate. When the bucket is full of water additional water enters spills over the sides and is lost.
Similarly, each network interface contains a leaky bucket and the following steps are involved in the leaky bucket algorithm:
Need of token bucket Algorithm:-
The leaky bucket algorithm enforces output patterns 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. One such algorithm is the token bucket algorithm.
Steps of this algorithm can be described as follows:
Let’s understand with an example,
In figure (A) we see a bucket holding three tokens, with five packets waiting to be transmitted. For a packet to be transmitted, it must capture and destroy one token. In figure (B) We see that three of the five packets have gotten through, but the other two are stuck waiting for more tokens to be generated.
Ways in which token bucket is superior to leaky bucket:
The leaky bucket algorithm controls the rate at which the packets are introduced in the network, but it is very conservative in nature. Some flexibility is introduced in the token bucket algorithm. In the token bucket, algorithm tokens are generated at each tick (up to a certain limit). For an incoming packet to be transmitted, it must capture a token and the transmission takes place at the same rate. Hence some of the busty packets are transmitted at the same rate if tokens are available and thus introduce some amount of flexibility in the system.
Formula: M * s = C + ρ * s
where S – is the time taken
M – Maximum output rate
ρ – Token arrival rate
C – Capacity of the token bucket in byte
This article is contributed by Vikash Kumar. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above