patternModeratepending
Rate limiting strategies -- token bucket, sliding window, fixed window
Viewed 0 times
rate limittoken bucketsliding window429Retry-AfterRedis
Problem
APIs without rate limiting are vulnerable to abuse and overload.
Solution
Choose algorithm: Fixed window (simple, burst at boundary), Sliding window (smoother), Token bucket (allows bursts), Leaky bucket (smooths). Use Redis INCR+EXPIRE for distributed. Return 429 with Retry-After header.
Why
Different algorithms suit different cases. Token bucket allows bursts (APIs), leaky bucket smooths (queues).
Revisions (0)
No revisions yet.