#leaky bucket
1 messages · Page 1 of 1 (latest)
?
The leaky bucket is an algorithm based on an analogy of how a bucket with a constant leak will overflow if either the average rate at which water is poured in exceeds the rate at which the bucket leaks or if more water than the capacity of the bucket is poured in all at once. It can be used to determine whether some sequence of discrete events c...
oh, like a queue with a size?
iirc nginx works like that.
sounds great, ill implement it when I find a use for it.
I made this netlimiter for my chat-app, based on how discord works with rate limits.
POST /channels/CHANNEL_ID/messages allows 5 requests per 5 seconds
i think i can use a leaky bucket alg for my web-lit (luvit) web-apps, if it is not already implemented under the hood
is nodejs express has leaky-bucket implementation under the hood? web-lit uses the same deps, so if express has it - weblit should too.
it is correct?
https://github.com/Be1zebub/Leaky-Bucket.lua
WIP. Contribute to Be1zebub/Leaky-Bucket.lua development by creating an account on GitHub.
yeah we've used these to spam proof certain stuff like net messages and whatnot
are you create a bucket for every player?
yeah
an example would be, allow the player to change/update a setting
idk lets say it's something like a large json net message that does some expensive server code
only allow 1 request every second with a bucket of 5
basically removes any risk of spam prevention and makes it feel a lot more organic for the user when they want to quickly apply settings to test something
did your net spam protection are global or youare used it only for specific nets?
could be both
what constants did you used for global net spam protection?
lemme get the code, i didn't make it tho
a good friend of mine did
iirc this uses a leakybucket
leaky bucket is great for preventing exploits in public addons, there's plenty of wiremod entities that are vurnable to just hard spamming their actions which can cause stuff ranging from lag to source engine issues
yeah, lenght is rarely the issue
the main issue is addons doing expensive stuff on net.Receive
and then spam taking advantage of it
why? reading giant data from net message is ok?
entirely depends on what an addon does with the data
isnt the advantage of a leaking bucket in the ability to be based on length?
yeah, but many small ones can cause major damage
I think that the previous algorithm is not worse than the leaking bucket when it comes to the usual counting number of calls.