Leaky Bucket Algorithm in Computer Networks

Leaky Bucket Algorithm:

The leaky bucket algorithm is a method of temporarily storing a variable number of requests and organizing them into a set-rate output of packets. This basic concept is applied in the case of the Leaky Bucket Algorithm which is nothing but a single server queueing system with constant service time.

Consider a bucket with a hole at the bottom. Whatever be the rate at which water enters into the bucket, it leaks out of the bucket at a constant rate through the hole. The rate of flow is zero if there is no water in the bucket and if the bucket is full then the excess water spills over and it is lost.

leaky-bucket algorithm

Basic Features of Leaky Bucket Algorithm:

    1. An interface containing a leaky bucket is connect each host to the network which is a finite internal queue.
    2. When space is available in a queue, a packet will send from an application in store.
    3. When the queue is full and a new packet will send from an application is discarded.
    4. The host operating system builds or simulates this arrangement in the hardware.
    5. The packets are queuing and releasing at regular intervals with the regular amount and that reduces the chances of congestion.

Problem: As the packets carry an uneven amount of data, The packets on the network is generates the actual loading effect that is also uneven.

Byte Counting Leaky Bucket Algorithm:

1. At every clock tick, a counter is initialised to a value n.
2. When the first packet in the queue –
if length < n then transmitter counter = n – length of the first packet
3. When additional packets are in the queue – sent along with the first packet if total length<n
4. For the first packet-
if length = n then transmitted
No other packet can be transmitted till the next clock tick
.
5. In the next clock, the tick counter is initialised to n.