Sliding window counter rate limiting algorithm is… #flashcard
Idea: Combines counts from two adjacent fixed windows, weighted by how far you are into the current one. Smooths out the spiky edge of the tumbling window.
- Pros:
- More accurate than tumbling window.
- Still efficient.
- Cons:
- Slightly more complex math.
Use case: API rate limiting where spiky patterns could cause issues but full log history is unnecessary.
- Analogy: Like fading memories — recent counts are more relevant than older ones.
<!--ID: 1753886610137-->