Open andylnkd opened 6 months 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).
Put on hold
Most basic rate limiting based on a IP. Limit 1000 results per day per IP.