QuestionQ499

Using APIs

An engineer builds an application responsible for parsing and analyzing data. Because the data is generated continuously in bursts, it disrupts the application's performance by overloading the available resources. The engineer wants to apply rate limiting on the receiving endpoint so that:

  1. A minimum data sample from every timeframe is guaranteed to be parsed.
  2. No more than a specific number of requests are processed at any one time.

Which rate limiting algorithm should the engineer use?

  • A leaky bucket
  • B sliding window
  • C fixed window
  • D event queue
Explanation

The leaky bucket algorithm buffers incoming requests and releases (processes) them at a constant, fixed rate regardless of how bursty the arrival pattern is. This smooths variable-rate bursty input into steady, predictable output, guaranteeing that some minimum amount of data is always processed during each timeframe while capping the number of requests handled at once to the bucket's fixed outflow rate/capacity. In contrast, fixed window and sliding window algorithms count requests over discrete or rolling time windows and can still allow bursts of traffic to be processed in clusters (e.g., near window boundaries), rather than enforcing a smooth, constant processing rate, so they do not reliably guarantee a minimum sample every timeframe under bursty load.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!