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

Implement Backend Fastapi limiter #281

Merged
merged 12 commits into from Jan 2, 2023

Conversation

kiritowu
Copy link
Collaborator

@kiritowu kiritowu commented Jan 2, 2023

Second PR for #175 .

Changes:

  • Include fastapi-limiter into backend requirements.txt
  • Created UserRateLimiter and APIClientRateLimiter as fastapi dependencies for API rate limiting with proper error handling code (e.g. OasstErrorCode.TOO_MANY_REQUESTS)
  • Update `docker-compose.yml to start redis server on backend-dev and establish proper connection in docker compose environment
  • Add rate-limiter dependecies to /api/v1/task endpoint as PoC.

To-Do:

  • Identify list of endpoints that requires API rate limiting and verify its compatibility with existing rate limiter
  • Perform load testing to study the appropriate parameters for both user and api-client of each endpoints.

@kiritowu kiritowu self-assigned this Jan 2, 2023
Copy link
Collaborator

@yk yk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you. I just left small questions

backend/oasst_backend/api/deps.py Outdated Show resolved Hide resolved
backend/oasst_backend/api/deps.py Outdated Show resolved Hide resolved
@yk
Copy link
Collaborator

yk commented Jan 2, 2023

thank you!

@yk yk merged commit 68f4976 into LAION-AI:main Jan 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants