rate limiting
Sliding Window Counter
Hybrid approach — weighted counters from current + previous windows
Weighted Count0.00 / 6
Current Window0
Previous Window0
Weight0.226
rollingCount = 0 + 0 × 0.226 = 0.00
Previous Window
Current Window
3.9s / 5s
Combined Weighted Count
// request log
No requests yet.
// how it works
Hybrid between Fixed Window and Sliding Window Log:
- Keep counters for current and previous windows
- Calculate overlap weight: (windowSize − elapsed) / windowSize
- rollingCount = current + (previous × weight)
- If rollingCount < limit → allow
// trade-offs
- O(1) time and space — just 2 counters
- Much more accurate than Fixed Window
- Memory efficient — no timestamp storage
- Approximation — not 100% exact
- Slightly more complex than Fixed Window