# Q7B · Leaky bucket and comparison

Subject: Computer Networks

Exam: TEE

Reader: https://deep-learning-study-room.vercel.app/cn/#tee/papers/tee-paper-reexam/q7b

Canonical: https://deep-learning-study-room.vercel.app/read/cn/tee/papers/tee-paper-reexam--q7b/

TEE · Actual TEE paper · all questions · current syllabus 702AI0C023

### Actual PYQ · Q7B. Draw a neat diagram and explain the working of the Leaky Bucket Algorithm. Is the Leaky Bucket Algorithm advantageous over the Token Bucket Algorithm? Justify your answer. [10 marks]

#### Answer

In the textbook **leaky-bucket queue/shaper** model, arriving packets enter a finite buffer. The output sends at a configured rate whenever data is queued. When the queue empties, it cannot send nonexistent packets; when the buffer is full, excess arrivals are dropped in this finite-buffer model.

Swipe across the diagram to read its labels ↔

![Leaky-bucket data queue](https://deep-learning-study-room.vercel.app/cn/fig/tee-leaky.77bdbcf957.svg)

Diagram: Leaky-bucket data queue. Labels: Leaky-bucket data queue | Leaky-bucket data queue | Bursty arrivals enter finite buffer B | Accept packets that fit; the stated queue model drops overflow. | Queue drains at configured rate r | Send while data exists. An empty queue produces no packets. | Smoother departure stream | Buffering adds delay; idle service cannot be saved for a later burst.

Finite data buffer smooths a burst into a bounded departure rate.

1. Choose buffer capacity B and output service rate r in consistent units.
2. Admit arrivals that fit. Drop/mark overflow according to the stated implementation; this queue example drops the excess.
3. Drain at rate r while the queue is nonempty. Idle time does not accumulate permission for a later faster burst.
4. The result is smoothed output. Larger buffers accommodate larger bursts but can increase waiting delay.

| Advantage | Limitation |
| --- | --- |
| Simple bound on output rate | Bursts may overflow or suffer delay |
| Reduces short-term output variation | Unused idle service cannot be saved |
| Useful for predictable traffic shaping | No end-to-end delay/loss guarantee by itself |

The term “leaky bucket” can also describe a conformance meter in standards. This course’s diagrams and numerical questions explicitly use the finite data-queue model, so its state is queued data rather than tokens.

#### Practical example

A queue of 20 packets drained at 5 packets/s needs 4 seconds to empty without new arrivals. If it is already full, an instantaneous extra burst cannot all be stored.

## Justified comparison

| Point | Leaky data queue | Token bucket |
| --- | --- | --- |
| Stored state | Queued data | Tokens representing permission |
| Idle period | Empty queue; unused service lost | Tokens accumulate up to B |
| Output burst | Smoothed by configured service rate | Allowed if enough tokens and physical capacity exist |
| Overflow/shortage | Finite queue can overflow | Shaper waits; policer may mark/drop |
| Main parameters | Queue capacity and drain rate | Token capacity and generation rate |
| Useful when | A smoother output profile is required | Average rate plus burst allowance is required |

#### Practical example

A steady-rate interface may use leaky shaping. A bursty file application can use token shaping to send short bursts while limiting its sustained rate.

Neither is always advantageous. Choose leaky queue shaping for smooth departures; choose token bucket when controlled bursts after idle time are desirable.

Source: Re-exam · 4 February 2026, original question paper page 3. Original marks retained; solution independently authored.
