Difference Between Token Bucket Algorithm and Leaky Bucket Algorithm

The differences between leaky and token bucket algorithm are:

Token Bucket Algorithm

Leaky Bucket Algorithm

It depends on tokens.

It does not depend on tokens.

If bucket is full, token is discarded but not the packet.

If bucket is full, then packets are discarded.

Packets can only transmit when there are enough tokens.

Packets are transmitted continuously.

Allows large bursts to be sent at faster rate. Bucket has maximum capacity.

Sends the packet at a constant rate.

The bucket holds tokens generated at regular intervals of time.

When the host has to send a packet , packet is thrown in bucket.

If there is a ready packet , a token is removed from Bucket and packet is send.

Bursty traffic is converted into uniform traffic by leaky bucket.

If there is no token in the bucket, then the packet cannot be sent.

In practice bucket is a finite queue outputs at finite rate.

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. But this technique is very restrictive. It does not credit an idle host. For example, if a host is not sending for a while, its bucket becomes empty. If the host has bursty data, the leaky bucket allows only an average rate. The time when the host is idle is not take into account. On the other hand, token bucket algorithm allows idle hosts to accumulate credit for the future in the form of tokens. And that is how it overcomes the shortcoming of leaky bucket algorithm.

Token Bucket Algorithm

The Token Bucket algorithm is a popular and simple method used in computer networking and telecommunications for traffic shaping and rate limiting. It is designed to control the amount of data that a system can send or receive in some sort of period, ensuring that the traffic conforms to a specified rate.

It refers to traffic control mechanisms that seek to either differentiate performance based on application or network-operator requirements or provide predictable or guaranteed performance to applications, sessions, or traffic aggregates. It is something that data flow seeks to attain.

Similar Reads

Need for Token Bucket Algorithm

Video and audio conferencing require a bounded delay and loss rate. Video and audio streaming requires a bounded packet loss rate, it may not be so sensitive to delay. a -critical applications (real-time control) in which bounded delay is considered to be an important factor. Valuable applications should provide better services than less valuable applications....

Flow Characteristics of Token Bucket Algorithm

Four types of characteristics are attributed to a flow: reliability, delay, jitter, and bandwidth....

Techniques to Improve QoS

There are several ways to improve QoS like Scheduling and Traffic shaping ,We will see each and every part of this in brief....

Difference Between Token Bucket Algorithm and Leaky Bucket Algorithm

The differences between leaky and token bucket algorithm are:...

Working of Token Bucket Algorithm

It allows bursty traffic at a regulated maximum rate. It allows idle hosts to accumulate credit for the future in the form of tokens. The system removes one token for every cell of data sent. For each tick of the clock the system send n tokens to the bucket. If n is 100 and host is idle for 100 ticks, bucket collects 10000 tokens. Host can now consume all these tokens with 10 cells per tick....

Steps Involved in Token Bucket Algorithm

Step 1: Creation of Bucket: An imaginative bucket is assigned a fixed capacity, known as “rate limit”. It can hold up to a certain number of tokens....

Advantage of Token Bucket over Leaky Bucket

If a bucket is full in tokens, then tokens are discarded and not the packets. While in leaky bucket algorithm, packets are discarded. Token bucket can send large bursts at a faster rate while leaky bucket always sends packets at constant rate. Token bucket ensures predictable traffic shaping as it allows for setting token arrival rate and maximum token count. In leaky bucket, such control may not be present. Premium Quality of Service(QoS) is provided by prioritizing different traffic types through distinct token arrival rates. Such flexibility in prioritization is not provided by leaky bucket. Token bucket is suitable for high-speed data transfer or streaming video content as it allows transmission of large bursts of data. As leaky bucket operates at a constant rate, it can lead to less efficient bandwidth utilization. Token Bucket provides more granular control as administrators can adjust token arrival rate and maximum token count based on network requirements. Leaky Bucket has limited granularity in controlling traffic compared to Token Bucket....

Disadvantages of Token Bucket Algorithm

Token Bucket has the tendency to generate tokens at a fixed rate, even when the network traffic is not present. This is leads of accumulation of unused tokens during times when there is no traffic, hence leading to wastage. Due to token accumulation, delays can introduced in the packet delivery. If the token bucket happens to be empty, packets will have to wait for new tokens, leading to increased latency and potential packet loss. Token Bucket happens to be less flexible than leaky bucket when it comes to network traffic shaping. The fixed token generation rate cannot be easily altered to meet changing network requirements, unlike the adaptable nature of leaky bucket. The implementation involved in token bucket can be more complex, especially due to the fact that different token generation rates are used for different traffic types. Configuration and management might be more difficult due to this. Usage of large bursts of data may lead to inefficient use of bandwidth, and may cause congestion. Leaky bucket algorithm, on the other hand helps prevent congestion by limiting the amount of data sent at any given time, promoting more efficient bandwidth utilization....

Frequently Asked Questions on Token Bucket Algorithm

What is leaky bucket algorithm?...