.NET Architecture & System Design Interview Question #139

What is the Sliding Window rate-limiting algorithm?

Resilience, Rate Limiting, Health Checks & Observability Senior Advanced

Quick Interview Answer

Sliding Window approximates or tracks request usage over a moving time range rather than resetting all capacity at a fixed boundary.

Detailed Explanation

Sliding Window approximates or tracks request usage over a moving time range rather than resetting all capacity at a fixed boundary.

It produces smoother enforcement than a simple fixed window but may require more state or computation. The exact implementation determines its accuracy and cost.

Code Example

At 12:01:20 evaluate requests
during approximately:
12:00:20 -> 12:01:20

No hard minute-boundary reset.