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 → 7Related terms
- rate limiting — Capping how many requests a client may make in a period of time, and rejecting or delaying the rest.
- Redis — A very fast in-memory data store used for shared caches, rate-limit counters, session data and pub/sub messaging.
Taught in
- Traffic Management: Sliding Window Rate Limiting — Production Full-Stack Engineering