getmagic-ai / kollaborate_v1

https://kollaborate-v1.vercel.app
0 stars 2 forks source link

[Search Post Launch] Add basic rate limiting #24

Open andylnkd opened 1 month ago

andylnkd commented 1 month ago

Most basic rate limiting based on a IP. Limit 1000 results per day per IP.

Arghya721 commented 4 weeks ago

Rate-limiting by IP can be done in two ways. 1) Using an in-memory cache to track the number of requests made. 2) Using redis and fastapi-limiter to track the number of requests made.

Issue with the first solution is we are hosting our API in cloud run, that runs in a stateless manner(serverless). When the service scales to multiple instances, each instance will have its own separate in-memory cache, leading to inaccurate/no rate limiting(even no rate limiting at all).

andylnkd commented 2 weeks ago

Put on hold