-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accuracy of reservoir refresh interval? #88
Comments
It's an oversight in the docs, it's actually only 5s (5000ms) when using Clustering and 250ms otherwise. It's set to 5000 for Clustering for performance reasons and it can be altered by passing the (currently undocumented) |
Ah, makes sense. I will add the heartbeatInterval option to my cluster and set it to 250ms. Cheers |
Glad that helps! Here's a few more details you might be interested in. The inaccuracy is only "below", not "above". What I mean is that the actual Reservoir Refresh Interval might be slower than your Also, assuming all of your servers have an accurate and consistent (across the cluster) internal clock, then the more limiters you have sharing the same Finally, the more traffic limiters get, the more accurate your refresh interval is. Again, it will never be "faster than As usual, make sure to benchmark and adjust it for your own use case. |
In the docs it says that the accuracy of
reservoirRefreshInterval
is +-5 seconds.This is a problem because many APIs have limits with 1 second granularity, i.e. they allow x requests every second. So, we may be off their rate limit by nearly 5x.
Is there something I can do to make sure the reservoir is refreshed accurately every second? Should I be using a custom timeout +
incrementReservoir
function?The text was updated successfully, but these errors were encountered: