Leaky Bucket

The algorithm is used for packet transmissions, to keep within defined limits on the bandwidth and burstiness of the network.

A simple leaky bucket algorithm can be implemented using FIFO queue.

The following is an algorithm for variable-length packets:

  • Initialize a counter to n at the tick of the clock.
  • Repeat until n is smaller than the packet size of the packet at the head of the queue.
  • Pop a packet out of the head of the queue, say P.
  • Send the packet P, into the network
  • Decrement the counter by the size of packet P.

Created from: Algorithms to know before system design interviews 202211231052


uid: 202211231056 tags: #algorithms #software-engineering


Date
February 22, 2023