Skip to content

Sliding Window Rate Limit

Spicy — senior dev territoryBackend

ELI5 — The Vibe Check

Sliding window rate limiting counts requests in a moving time window instead of fixed buckets. With fixed windows, you could make 100 requests at 11:59 and 100 more at 12:00 — 200 in two seconds! Sliding window prevents this by always looking back exactly N minutes from right now. It's like a rolling average that smooths out the spikes.

Real Talk

Sliding window rate limiting combines the simplicity of fixed windows with the accuracy of per-request tracking. It uses weighted counting from the previous and current fixed window to estimate the request count in the sliding window. This prevents the boundary burst problem of fixed window counters while being more memory-efficient than per-request log-based approaches.

When You'll Hear This

"Switch to sliding window — clients are gaming the fixed window boundaries." / "The sliding window counter uses Redis sorted sets for efficient counting."

Made with passive-aggressive love by manoga.digital. Powered by Claude.