Problem Statement
What is a downside of the fixed-window counter algorithm?
Explanation
With fixed windows, a client can send near the end of one window and immediately at the start of the next, effectively doubling the rate for a moment. This can overload downstreams.
Sliding window (log or rolling) or token bucket reduces the boundary artifact by smoothing limits across time.
Code Solution
SolutionRead Only
key = user+":"+floor(now/60); INCR key; EXPIRE key 60;
