Sliding window throttling implementation #511
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is more advanced throttling mechanism based on #410
There is a window of some size, if interval is not set it defaults to 1 second, otherwise it got parsed by similar to GNU/sleep parser.
This interval is window pane, we slide one pane at interval, and calculate average over entire window. We also have a slow start, to prevent overflowing at the beginning of the window.
Basically rate of 100 with window of
5
with interval set to1m
is different than rate of 3 with window 300 and interval of 1s, because in first example it is possible to get all 100 messages in first second, while second one, will accept only 3 and wait for the next second to accept the rest.We have this working in production for more than 3 months, and everything is working as expected.
P.S. I'm sorry that this took so long, I had problems with my spine, and was waiting for standing desk at the office :(