Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-48390: Implement API rate limiting #1210

Merged
merged 1 commit into from
Jan 14, 2025
Merged

DM-48390: Implement API rate limiting #1210

merged 1 commit into from
Jan 14, 2025

Conversation

rra
Copy link
Member

@rra rra commented Jan 11, 2025

Add enforcement of API rate limits if the user has an API quota for the service set in the GafaelfawrIngress. If the request is rejected by rate limiting, Gafaelfawr will return a 429 error with the HTTP Retry-After header set to the time at which the rate limit resets.

Rate limiting is implemented using the limits Python package, which unfortunately introduces a second Redis client with a separate pool (coredis). Currently, rate limiting uses a fixed window without any fancy rolling expiration or burst protection.

See SQR-073 for details about this design.

@rra rra force-pushed the tickets/DM-48390 branch from 1a6686e to 9fe4790 Compare January 11, 2025 01:41
Add enforcement of API rate limits if the user has an API quota for the
service set in the `GafaelfawrIngress`. If the request is rejected by
rate limiting, Gafaelfawr will return a 429 error with the HTTP
`Retry-After` header set to the time at which the rate limit resets.

Rate limiting is implemented using the `limits` Python package, which
unfortunately introduces a second Redis client with a separate pool
(`coredis`). Currently, rate limiting uses a fixed window without any
fancy rolling expiration or burst protection.
@rra rra force-pushed the tickets/DM-48390 branch from 9fe4790 to d1c24f3 Compare January 11, 2025 01:48
@rra rra merged commit 47771c2 into main Jan 14, 2025
5 checks passed
@rra rra deleted the tickets/DM-48390 branch January 14, 2025 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant