-
Notifications
You must be signed in to change notification settings - Fork 497
[WIP] feat: replace uwsgi with granian #1321
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
base: release
Are you sure you want to change the base?
[WIP] feat: replace uwsgi with granian #1321
Conversation
481f368 to
e527b3e
Compare
|
Just a warning that I have a suspicion that MIT's switch to granian may have been responsible for exposing a multi-threading related bug in grading. This wouldn't be any fault of granian's, but more a case where granian's deployment strategy exposes already-existing problems. This is highly speculative on my part, and the investigation is ongoing. I just wanted to bring this to your attention early. The bug needs to be fixed regardless, so I don't expect it to block granian in the long term, even if this hypothesis turns out to be true. |
e527b3e to
7becdfe
Compare
7becdfe to
c5d2e23
Compare
| --reload | ||
| --reload-paths /openedx/granian-reload-path |
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.
This is for watching a directory and reloading if there are file changes detected, right? Just out of curiosity, why enable this in a prod environment?
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.
We had a reload-uwsgi command as well. Here is the rational behind doing it. This is just a replacement for that. Now the reload-granian command puts current timestamp in the file mentioned in --reload-paths to trigger a reload.
|
Quick update: We believe the multi-threading issue has been fixed, though we're still waiting for MIT to deploy it on their instance next week to verify that it resolves the issues they've been seeing there. |
PLEASE REACH OUT TO @ahmed-arb FOR UPDATES ON THIS PR.
closes #937
This PR replaces uwsgi with granian.
All uwsgi related docs have been updated.
All uwsgi related patches and configs values have been renamed.
All uwsgi related files have been deleted and replaced with granian equivalents.
Here are the uwsgi configs/features we are currently using and their granian equivalents.
static-map = /static=/openedx/staticfiles/
static-map = /media=/openedx/media/
Even though
--static-path-route&--static-path-mountare available, they can only server from one path, in order to server both of them we must use caddy.http = 0.0.0.0:8000
--host&--portbuffer-size = 8192
--http1-buffer-size 8192
wsgi-file = $(SERVICE_VARIANT)/wsgi.py
Use this parameter
$SERVICE_VARIANT.wsgi:applicationprocesses = $(UWSGI_WORKERS)
--workersApparently granian does not have thundering herd problem, see Related Granian discussion
single-interpreter = true
enable-threads = true
Threads are enabled by default. You can explicitly set them with
--runtime-mode. Set the number of threads with--runtime-threads.http-keepalive = 1
--http1-keep-alive enabled by default
❌ add-header = Connection: Keep-Alive
Can not add arbitrary headers with granian, does this affect us if we have
--http1-keep-alive?die-on-term = true
Granian handles SIGTERM as a shutdown signal by default
lazy-apps = false
need-app = true
no-defer-accept = true
master = true
py-call-osafterfork = true
vacuum = true
Reload
We can define a file in the
--reload-pathsand changing that file will restart the server. We also need to install thereloaddependency and also unable the--reloadconfig.