api-designbackendsystem-design
Token buckets allow bursts without unlimited traffic
Anonymous
A token bucket permits bursts up to its capacity while limiting long-run traffic to its refill rate. Keep a token count and a last-refill time; add tokens based on elapsed time, cap at capacity, then consume one per admitted request. A fixed window is simpler, but traffic near a window boundary can briefly exceed the nominal per-window limit.
0