• No results found

Figure 8.5

Congestion control algorithms

Congestion control algorithms

Token bucket algorithm

Load shedding algorithm Leaky bucket

algorithm

8.8.1 Leaky bucket algorithm: - This is a congestion control algorithm which is very simple to understand. Let us suppose a bucket with a hole at bottom; bucket has capacity to hold and store a lot of packets according to its capacity and the small hole at bottom withdraw the packets one by one. This will control the transmission between sender and receiver and also controls the congestion.

But now here question arise that what will happen if the bucket if full? And the answer is that all the other packets will be discarded automatically which are overloading the bucket. This simple phenomenon is known as leaky bucket algorithm.

Figure 8.6 Leaky bucket algorithm

As shown in the diagram following steps will be followed in leaky bucket algorithm

 When the source has to send the data packet it will throw it into the bucket

 The leaking rate of bucket is constant i.e. the network interface transmits packet at constant rate.

 Burst traffic will be converted to uniformity by the leaky bucket algorithm.

Figure 8.7

Working of Leaky bucket algorithm

As shown in diagram when packet arrives if there is room in queue it will be queued up and if there is no room it will be discarded.

Implementation: - Now here question arise

“Are all the packets will be of same size”

And the answer is obviously not at all time. If the packet size is all same this algorithm can be used as it is described but if the packets are of variable sized it is better to allow fixed number of bytes per tick rather than one packet. Thus here the rule is each packet would be of 1024 bytes per tick. If the packet size is 1024 bytes, one packet will be sent if the packet size is 512 bytes, two packets per tick and four 256 bytes packets and so on.

Figure 8.8

Implementation of Leaky bucket algorithm

A Leaky bucket algorithm shapes bursty traffic into fixed-rate traffic by averaging the data rate. It may drop the packets if the bucket is full.

Algorithm: -

1. Initialize a counter to ‘n’ at the tick of the clock.

2. If ‘n’ is greater than the packet size, then send the packet and decrement the counter by the packet size.

3. Repeat step 3 until ‘n’ becomes smaller than the packet size.

4. Change the counter and go to step 1.

8.8.2 Token bucket algorithm: - Above discussed leaky bucket algorithm follows a simple pattern of output irrespective of input stream. For a lot of applications. It is important to transmit message and speed up the delivery. Token bucket algorithm provides a very simple solution to this problem.

Here leaky bucket algorithm holds a token generated at regular intervals.

Algorithm: -

1. A token is added to the bucket every 1/r second.

2. A bucket can hold at most ‘n’ tokens. If it reaches its peak level packets will be discarded.

3. If the packet of ‘n’ bytes reaches, ‘n’ tokens are removed from bucket and packets are sent to network.

4. If less than ‘n’ tokens are available. No tokens will be removed from bucket.

Figure 8.9

Working of token bucket algorithm

Figure 8.10

Implementation of token bucket algorithm

Performance: - If we call the burst length S sec, the token bucket capacity C bytes, the token arrival rate P bytes/sec and the maximum output rate M bytes/sec, we see that output burst contains a maximum of C+P.S bytes. We also know that the number of bytes in maximum speed burst of length S seconds is MS.

Hence we have C+P.S=MS

We can also solve the equation to get S = C / (M-P)

Question: - A computer on a 6 Mbps network is regulated by a token bucket. The token bucket is filled at a rate of 1 Mbps. It is initially filled to capacity with 8 megabits. How long can the computer transmit at the full 6 Mbps.

Answer:

Using formula

= Here C=8Mbps, M=6 Mbps, P=1 Mbps

= =8/5 =1.6 sec.

, ℎ 1.6 .

8.8.3 Combination of token bucket and leaky bucket algorithms: - Both leaky bucket and token bucket algorithms have some advantages and some disadvantages even than they can be combined together to get some advantages

1. To credit an idle host.

2. To regulate the traffic.

Token bucket algorithm is used on priority basis than leaky bucket algorithm.

8.8.4 Difference between Token bucket and leaky bucket algorithms: -

8.8.5 Load Shedding: - When nothing works for computer networks, load shedding works.

In this routing algorithm there is no fixed rule of dropping packets. Packets can be dropped at any point randomly. The principal of load shedding says that if the router is flooded by data

packets which cannot be handled by it. They just throw them all. The routers which are flooded with packets due to congestion can drop any packet at random.

This could be better if discarding of packets depends on the application which is running.

Check your progress / Self-assessment questions Exercise-III

Q1.write names of congestion control algorithms.

___________________________________________________________________________

___________________________________________________________________________

______

Q2.How combination of leaky bucket and token bucket algorithm helps to solve congestion problems in a better way?

___________________________________________________________________________

___________________________________________________________________________

______

Q3.Leaky bucket algorithm is based on what principal?

___________________________________________________________________________

___________________________________________________________________________

______

Q4. In leaky bucket and token bucket algorithms is it compulsory that packet size will always be of same size?

a. True b. False

8.9 Quality of service: - The quality of a subnet is determined by four primary parameters:

reliability, delay, jitter and bandwidth. Summing up these terms will give the better quality of service.

Figure 8.11 Quality of service

8.10 Summary

 Performance of a network can be measured by its delay rate and throughput.

 Sources of congestion could be Traffic policing, Route Control and Packet Switching.

 Congestion control algorithms are of three type Leaky bucket, Token bucket and Load shedding algorithms.

 Quality of a network can be judged by its bandwidth, jitter, delay and reliability.

 One or more congestion control algorithms can be combined for better outcomes.

 Load shedding congestion control algorithm drops data packets with no fixed rule alike leaky bucket and token bucket algorithms.

 Various layers follow different policies to prevent congestion.

8.11 Glossary

Congestion control: It is a mechanism or techniques which controls the traffic on network and maintain the load under capability.

Leaky bucket algorithm: It shapes the bursty traffic into fixed-rate traffic by averaging the data rate. It may drop the packets if the bucket is full.

Token Bucket algorithm: It holds a token generated at regular intervals to speed up the transmission of data packets.

Quality of service

Related documents