79702949

Date: 2025-07-16 05:38:56
Score: 1
Natty:
Report link

If you refill your tokens (or resetting counters for fixed window, same thing) only at the beginning for each interval, you will get the bursty side effect, allowing at most of 2x of the intended allowed requests.

You can tweak it to refill the tokens evenly like 6 requests/sec in your example. That will reduce the burstiness, however it may become overkill because it can sometimes limit request even it completely satisfies "10/min" target.

To fix this, the algorithm will have to take account of each request's time of arrival. That will effectively make the "granularity" infinitely small. The cost is the additional space usage.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: user3321813