Subscribe by Email


Showing posts with label Leaky bucket algorithm. Show all posts
Showing posts with label Leaky bucket algorithm. Show all posts

Monday, September 2, 2013

Application areas of leaky bucket algorithm and token bucket algorithm

In this article we discuss about the applications of the leaky bucket algorithm and the token bucket algorithm.  

Applications of Leaky Bucket Algorithm
- The leaky bucket algorithm is implemented in different versions. 
- For example, the generic cell rate algorithm is a version of this algorithm which is often implemented in the networks using ATM (asynchronous transfer mode).  
- The algorithm is applied at the user interfaces in the usage/network parameter control in order to provide protection to the network from the problems of congestive collapse or excess traffic. 
- An algorithm equivalent to the generic cell rate algorithm might be used in shaping the transmissions made by the network interface card to a network using ATM. 
There are two major applications of the leaky bucket algorithm. 
- The first is using it as a counter only for checking whether the events or the traffics confirm to the defined limits or not.
- Whenever a packet arrives at the check point, the counter is incremented. 
This is same as adding water to the bucket in an intermittent way. 
- In the same way, the counter is decremented as the water leaks out at a constant rate. 
- Because of this, the conformance of the packet to the burstiness and bandwidth limits is indicated by the value of this counter whenever a packet arrives. 
- Or if an event occurs, the counter checks whether it confirms to the peak and average rate limits. 
- So, when the packets arrive or an event occurs, water is added to the bucket and then leaks out. We call this version of the leaky bucket algorithm as a meter.
- Another application of the leaky bucket algorithm involves its use as queue implemented for controlling the flow of traffic. 
- This queue maintains a direct control over the flow. 
- When the packets arrive, they are put in to the queue. 
- This is same as adding water to the bucket. 
- The packets are then removed in the order they arrived at a constant rate. 
This is same as water leaking out. 
- As a result of this, there is no jitter or burstiness in the traffic flow.

Applications of Token Bucket Algorithm
- The token bucket algorithm finds its application in the telecommunications and packet switched computer networks.
- This algorithm is implemented for checking whether the data transmissions confirm to the burstiness and bandwidth predefined limits. 
- The token bucket algorithm used in traffic policing and traffic shaping. 
- In the former, the packets that are non-conformant are discarded or assigned low priorities. 
- This is done for the management of the downstream traffic. 
- On the other hand, the packets are kept in delay unless they are conformed in traffic shaping. 
- Both of these are used in protecting the network against the burstiness of the traffic. 
- Bursty traffic gives rise to congestion problems. 
- These algorithms help in managing the bandwidth as well congestion of the network. 
- Network interfaces commonly use the traffic shaping process for preventing the discarding of the transmissions by the network’s traffic management functions. 
- This algorithm is based up on the analogy of a bucket with fixed capacity. 
Tokens are added to this bucket at a fixed rate and represent a single packet of a fixed size. 
- When the packet has to be checked whether it confirms to the predefined limits or not, first the bucket is checked if it contains sufficient tokens. 
- If sufficient tokens are there, tokens equal to the number of bytes in the packet are removed and the packet is transmitted. 
- If sufficient tokens are not there, the packet is said to be non-conformant and the number of tokens in the bucket remain unchanged.




Saturday, August 31, 2013

What is the difference between leaky bucket algorithm and token bucket algorithm?

- Telecommunications networks and the packet switched computer networks make use of the leaky bucket algorithm for checking the data transmissions. 
This check is carried out in the form of packets. 

About Leaky Bucket Algorithm
- This algorithm is used for determining whether the data transmissions confirm to the limits that have been defined for the burstiness and bandwidth. 
Leaky bucket counters also use the leaky bucket algorithm for detecting the peak or the average rate of the stochastic or random events and processes and if they are exceeding the predefined limits. 
We shall take analogy of a bucket for explaining this algorithm.
Consider a bucket having a hole in its bottom through which the water it has will leak away. 
- The rate of leakage is constant if it is not empty. 
- We can intermittently add water to it that is in short bursts. 
- But if a large amount of water is added to it in one go, the water will exceed the bucket’s capacity and overflow will occur. 
- Hence, it is determined using this leaky bucket algorithm that whether or not adding water to it will make up the average rate or will exceed it. 
- Leak rate sets the average rate of adding the water and depth of the bucket decides the amount of water to be added. 
- Asynchronous transfer mode networks use the generic cell rate algorithm which is one of the versions of the leaky bucket algorithms. 
- At the user network interfaces, these algorithms are used in the usage/ network parameter control. 
- The algorithm is also used in network-network interfaces and inter-network interfaces for protecting networks from the overwhelming traffic levels through the connections in the network. 
- A network interface card can be used on a network using ATM for shaping the transmissions. 
- This network interface card might use an equivalent of the generic cell rate algorithm or this algorithm itself.
The leaky bucket algorithm can be implemented in two different ways both of which are mentioned in the literature. 
- It appears as if there are two distinct algorithms that are together known as the leaky bucket algorithm.

About Token Bucket Algorithm

- At an interval of every 1/r seconds the token bucket algorithm adds a token to a bucket. 
- The maximum number of tokens that can be handled by a bucket are b. 
- Any token above this limit is rejected by the bucket. 
- When the bucket receives a packet from the network layer consisting of n bytes, the n numbers of tokens are taken out from the bucket and then the packet is transmitted in to the network. 
- If number of tokens available is less than n, the packet is treated as being non-conformant. 
- A bucket with a fixed capacity is associated with some virtual user and the rate at which it leaks is fixed. 
- No leakage occurs if there is nothing in the bucket. 
- Some water has to be added to the bucket in order to make the packet conform-ant. 
- No water is added to the bucket if adding this amount of water will cause the bucket to exceed its capacity. 
- Therefore, we can see that one algorithm adds something constantly to the bucket and removes also for conforming packets. 
- The other algorithm removes something constantly and adds something for confirming packets. 
- Both the algorithms are same in effectiveness and this is why the two see each the same packet as non-confirming or confirming. 
- The leaky bucket algorithm is often used as meter. 


Facebook activity