7 ms·
It is a shame GCRA is not more well known and used for rate limiting. It is, in my view, a better algorithm. https://medium.com/smarkets/implementing-gcra-in-p
by pgjones 2y ago
It is a shame GCRA is not more well known and used for rate limiting. It is, in my view, a better algorithm.
https://medium.com/smarkets/implementing-gcra-in-python-5df1f11aaa96 https://medium.com/smarkets/implementing-gcra-in-python-5df1...
https://en.m.wikipedia.org/wiki/Generic_cell_rate_algorithm https://en.m.wikipedia.org/wiki/Generic_cell_rate_algorithm
- gpderetta 2y agoIsn't GCRA a variant of leaky bucket, i.e. the token bucket described in the article? As far as I can tell, the behavior should be the same, the difference is just implementation details and what you track.
- 0pteron 2y agoIf leaky bucket means "manages burst sizes and burst intervals" then yeah, they are similar in that regard but they do it differently. GCRA is more analogous to a traffic light where its solely time-based and there is no overhead needed to remove/add tokens so you are storing 1 less state object. For all purposes its probably a micro-optimization but being aware how GCRA works can yield less code but perhaps at the expense of obscurity of a lesser known algo. I think you understand the differences but I think its improper to consider it a variant of leaky bucket as various resources refute
- deleted 2y ago[deleted]