Replace gunicorn with uwsgi, use persistent db connections #90

Merged
Oleg-Komarov merged 3 commits from asgi-to-wsgi into main 2024-04-25 15:11:09 +02:00
Owner

The main goal is to configure persistent db connections, this solves two problems:

  • improves latency
  • in combination with a fixed number of uwsgi workers it puts a limit on the number of db connections the website can open, and this makes db usage predictable

It appears that django doesn't support persistent db connections with asgi yet:
https://github.com/django/django/pull/17914#issuecomment-1986390557
https://github.com/django/django/pull/16881
otherwise we could potentially switch to using a connection pool and continue using asgi.

This change also makes it more consistent with the rest of our web infra, which is using the same uwsgi deployment model.

Deployment:

./ansible.sh -i environments/production install.yaml --tags=pull,uwsgi
./ansible.sh -i environments/production deploy.yaml
The main goal is to configure persistent db connections, this solves two problems: - improves latency - in combination with a fixed number of uwsgi workers it puts a limit on the number of db connections the website can open, and this makes db usage predictable It appears that django doesn't support persistent db connections with asgi yet: https://github.com/django/django/pull/17914#issuecomment-1986390557 https://github.com/django/django/pull/16881 otherwise we could potentially switch to using a connection pool and continue using asgi. This change also makes it more consistent with the rest of our web infra, which is using the same uwsgi deployment model. Deployment: ``` ./ansible.sh -i environments/production install.yaml --tags=pull,uwsgi ./ansible.sh -i environments/production deploy.yaml ```
Oleg-Komarov added 2 commits 2024-04-25 13:28:54 +02:00
Oleg-Komarov added 1 commit 2024-04-25 15:10:13 +02:00
Anna Sirota approved these changes 2024-04-25 15:10:36 +02:00
Oleg-Komarov merged commit f20d4c7e99 into main 2024-04-25 15:11:09 +02:00
Oleg-Komarov deleted branch asgi-to-wsgi 2024-04-25 15:11:09 +02:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: infrastructure/extensions-website#90
No description provided.