-
Notifications
You must be signed in to change notification settings - Fork 337
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
Add leaky-bucket algorithm #205
Comments
(I would add this as an additional throttle, I'm not thinking about replacing the old one) |
That's an interesting possibility. Do you think it's possible to implement a leaky bucket algorithm in memcached? It's not obvious to me. 😊 |
Yes, you'd save both the capacity and the last time it was updated, you set the TTL to the maximum time it would take to leak. Then, before you update a value, you can calculate how many seconds have passed, update the number to reflect what had leaked out, and then increase the 'drops'. |
I'll see if I can build a PoC for this to show how it would work! |
Hey @ktheory, I've created a PR (and it's green 🎉), let me know if you've got any questions or remarks! |
The Leaky Bucket Algorithm seems like a more natural algorithm to throttle requests. I've integrated this in a PHP port of rack-attack and authored it as a individual plugin: jeroenvisser101/LeakyBucket. I'd love to contribute this, as Ruby code, to rack-attack. Is this something that would fit in the vision of rack-attack?
The text was updated successfully, but these errors were encountered: