TsgcWSRateLimiter › Properties › SlidingWindow
Sliding Window algorithm configuration: MaxRequests over a rolling WindowSec.
property SlidingWindow: TsgcRateLimitSlidingWindow read FSlidingWindow
write SetSlidingWindow;
—
Stores a timestamp for every request and counts the timestamps that fall inside a rolling window of WindowSec seconds. Rejects when the count would exceed MaxRequests. The window slides continuously, so there is no hard reset moment where a burst can slip through — unlike Fixed Window, which would let a client fire 100 requests at 12:00:59 and another 100 at 12:01:00. Set this as the global default strategy when you publish a strict SLA that must be enforced exactly over any rolling period.
// Strict SLA: max 100 requests in any rolling 60 seconds
sgcWSRateLimiter1.SlidingWindow.Enabled := True;
sgcWSRateLimiter1.SlidingWindow.WindowSec := 60;
sgcWSRateLimiter1.SlidingWindow.MaxRequests := 100;