Back to the 2025 paper

Module 4: Transport Layer & Congestion Control

20257m

Explain how the Leaky Bucket algorithm is used in traffic shaping and rate-limiting.

Worked SolutionAI Assisted

Leaky Bucket Algorithm

A traffic shaping algorithm that turns bursty traffic into a steady, constant-rate flow, like water leaking from a bucket through a small hole at a fixed rate.

SVGVector Architecture Diagram (SVG)
Bursty input packets Bucket (finite buffer) Overflow: discarded Constant rate output

Working

  1. Packets arriving from the host are placed in a finite-size queue (bucket).
  2. Packets leave the bucket at a fixed rate ρ\rho, whatever the arrival rate.
  3. If the bucket is full, new packets are dropped (or marked).
  4. For variable-size packets, a fixed number of bytes per clock tick is released.

Use in traffic shaping

  • Smooths bursts so the network sees a predictable, uniform flow, reducing congestion at routers.
  • Applied at the network edge so traffic conforms to the agreed profile (SLA).

Use in rate-limiting

  • The output rate ρ\rho is the maximum allowed rate; the bucket size limits the burst absorbed.
  • Excess traffic beyond bucket capacity is discarded, which enforces the limit (e.g. API/ISP rate limiting, policing in routers and gateways).

Note

The leaky bucket never allows output above ρ\rho, even after idle periods. The Token Bucket algorithm allows controlled bursts.

Similar questions

Student FinanceWeb Platform

Pocketly — Personal Finance for Students

Keep your hostel and college expenses under control. Track accounts, log spending in seconds, and stay within your monthly budget.