sliding window counter

A rate-limiting method that estimates the requests in the last full window by weighting the previous window’s count by how much of it still overlaps.

In more detail

A fixed window resets on the minute, so a client can send a full quota at 0:59 and another at 1:01. A sliding window log stores every timestamp and is exact but memory-hungry. The sliding window counter keeps just two numbers and computes previous × (1 − progress) + current, which smooths out the boundary burst with constant memory.

Example

estimate = Math.floor(prev * (1 - progress) + curr)   // 10, 2, 0.5 → 7

Related terms

Taught in

References