Sliding window throttling implementation#511
Conversation
73958a1 to
f529e47
Compare
|
thanks for the PR. I did a quick non-tech review and I have two comments:
|
|
Removed Anchorfree mentioning from source code. Not sure about License, isn't Apache 2.0 compatible with GNU v3, at least Wikipedia told me that. Do you want me to create similar function under Apache license or to remove code completely? |
|
they are compatible if that code base lives in a separated shared library, but they cannot live together in one binary. Better to get rid of any GPL code in our code base, btw, why not to use direct strtod() provided by stdlib.h ? that should be fine |
Based on sliding window algorithm
|
Indeed, I've reworked it to use standard |
|
thanks! |
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
5with interval set to1mis 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 :(