Rate limit library. Currently implemented rate limits are
Fixed window rate limit
Fixed window limits—such as 3,000 requests per hour or 10 requests per day—are easy to state, but they are subject to spikes at the edges of the window, as available quota resets. Consider, for example, a limit of 3,000 requests per hour, which still allows for a spike of all 3,000 requests to be made in the first minute of the hour, which might overwhelm the service.
Starts counting time windows when the first request arrives.
Fixed truncated window rate limit
Same as Fixed Window rate limit but truncates the rate limit window to the rate interval configured in order to adjust to real time intervals passing. E.g:
- Rate limit interval is configured for new windows every 10 seconds
- First request arrives at
- Current rate limit window: from
You can refer to google architecture docs to read more about rate limits.
- Fixed window bucket variant (refill token with capacity at same rate)
- Redis storage
- Token bucket
- Leaky bucket