Is it recommended to make your own Rate Limiter?
Answered
Bluetick Coonhound posted this in #help-forum
Bluetick CoonhoundOP
Just a simple question i have, i've seen the likes of KV and UpStash and they do cost quite a bit. Do you guys think that making my own Rate Limiter would be beneficial or should i continue using UpStash?
This is the Rate Limiter i found in stackoverflow that seems to work:
This is the Rate Limiter i found in stackoverflow that seems to work:
Answered by Dusky-capped Flycatcher
Hi, that kind of "local" rate limiter (w/o redis etc..) has its limits in a serverless world because in the worst case, each user's request could land on a new server w/o the history of the previous requests.
Despite this (serious) limitation, I personally use something like that for costly API requests with the hope that it will still detect a lot of not-intentionnal mis-usages. My 2 cents...
Despite this (serious) limitation, I personally use something like that for costly API requests with the hope that it will still detect a lot of not-intentionnal mis-usages. My 2 cents...
4 Replies
Dusky-capped Flycatcher
Hi, that kind of "local" rate limiter (w/o redis etc..) has its limits in a serverless world because in the worst case, each user's request could land on a new server w/o the history of the previous requests.
Despite this (serious) limitation, I personally use something like that for costly API requests with the hope that it will still detect a lot of not-intentionnal mis-usages. My 2 cents...
Despite this (serious) limitation, I personally use something like that for costly API requests with the hope that it will still detect a lot of not-intentionnal mis-usages. My 2 cents...
Answer
@Dusky-capped Flycatcher Hi, that kind of "local" rate limiter (w/o redis etc..) has its limits in a serverless world because in the worst case, each user's request could land on a new server w/o the history of the previous requests.
Despite this (serious) limitation, I personally use something like that for costly API requests with the hope that it will still detect a lot of not-intentionnal mis-usages. My 2 cents...
Bluetick CoonhoundOP
I see, then it's recommended i use an API like UpStash or KV instead?
Dusky-capped Flycatcher
Not sure what is "recommended"... your milage may vary.
Bluetick CoonhoundOP
I see, thanks for answering my question either ways