-
Notifications
You must be signed in to change notification settings - Fork 37
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
config: increment default rate limiting #323
config: increment default rate limiting #323
Conversation
diegodelemos
commented
Nov 23, 2020
- Addresses Error message "Cannot start workflow" reana#286.
Codecov Report
@@ Coverage Diff @@
## maint-0.7 #323 +/- ##
==========================================
Coverage 54.37% 54.37%
==========================================
Files 17 17
Lines 1337 1337
==========================================
Hits 727 727
Misses 610 610 |
reana_server/config.py
Outdated
@@ -116,6 +116,10 @@ def _(x): | |||
APP_DEFAULT_SECURE_HEADERS["content_security_policy"] = {} | |||
APP_HEALTH_BLUEPRINT_ENABLED = False | |||
|
|||
# Rate limiting configuration | |||
# =========================== | |||
RATELIMIT_ENABLED = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently hardcoding this value.. but actually, it would be interesting to make it configurable in case someone wants to adjust it. Some thoughts about it:
Limiting with Invenio-App/Flask-limiter:
- Flexibility: Configuring means touching many different variables (limiting per endpoint, limiting auth VS anonymous users) which allow fine-tuning.
- To be adapted to Kubernetes: By default the limiter relies on in memory entries to store for the number of requests (this would become a problem if RS is scaled up). The solution is easy and it would be to connect the rate limiter to Redis (to be tested).
Limiting with Traefik rate limiter:
- Less-flexibility: We would have less granularity as doing it inside the application.
- Closer to prod setup: It would be more similar to what we do in prod with HAProxy.
- More harmony: the approach of rate-limiting inside the app wouldn't work for Interactive sessions (and future entities like them), Traefik would.
Not providing any in-cluster option to limit requests. Advice to use external service (like we do with HAProxy).
f5ded3e
to
d5c200c
Compare
@@ -116,6 +116,11 @@ def _(x): | |||
APP_DEFAULT_SECURE_HEADERS["content_security_policy"] = {} | |||
APP_HEALTH_BLUEPRINT_ENABLED = False | |||
|
|||
# Rate limiting configuration | |||
# =========================== | |||
RATELIMIT_AUTHENTICATED_USER = "20 per second" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please amend CHANGES.rst
and say something like:
- Changes rate limiting defaults to allow up to 20 connections per second.
d5c200c
to
e1e2020
Compare
e1e2020
to
3091416
Compare
CHANGES.rst
Outdated
@@ -8,6 +8,8 @@ Version 0.7.1 (2020-11-10) | |||
- Fixes restarting of Yadage and CWL workflows. | |||
- Fixes conflicting ``kombu`` installation requirements by requiring Celery version 4. | |||
- Changes ``/api/you`` endpoint to include REANA server version information. | |||
- Changes rate limiting defaults to allow up to 20 connections per second. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Must go into a new section:
Version 0.7.2 (UNRELEASED)
--------------------------
- Changes rate limiting defaults to allow up to 20 connections per second.
3091416
to
106b88c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally. The situations where I simulated rate limitations before:
File /LICENSE was successfully uploaded.
File /LICENSE was successfully uploaded.
File /LICENSE was successfully uploaded.
Something went wrong while uploading .../LICENSE:
60 per 1 minute
Something went wrong while uploading .../LICENSE:
60 per 1 minute
Something went wrong while uploading .../LICENSE:
60 per 1 minute
File /LICENSE was successfully uploaded.
File /LICENSE was successfully uploaded.
File /LICENSE was successfully uploaded.
are now passing fine 👍