Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#32773 closed Cleanup/optimization (invalid)

Production Configuration of Django 3.2 with gunicorn and uvicorn

Reported by: allen-munsch Owned by: nobody
Component: Documentation Version: 3.2
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by allen-munsch)

Hoping for a bit of guidance here.

How can I contribute to the documentation of using django ASGI in a production environment?

Also, Any suggestions on tuning these things for relatively the same performance?

Current settings ( seems to perform at about the same )
py3.8.10
django3.2
gunicorn with 18 workers using uvicorn.UvicornWorker
10 heroku Performance L instances

Previously
py3.6.13
django2.2.5
gunicorn with 10 workers using eventlet
7 heroku Performance L instances

However, notice the two instance difference is quite a bit extra in cost.

wrote out a thing to roughly benchmark django and fastapi being part of the same ASGI app.

https://github.com/allen-munsch/benchmark-django-fastapi/

Specifically trying to determine upgrading from django 2.2.5 to django 3.2 and layering in FastAPI and running it in a production environment.

Anyone here have any advice on doing that?

https://github.com/allen-munsch/benchmark-django-fastapi/blob/main/docker/web/docker-asgi-with-static-entrypoint.sh
https://github.com/allen-munsch/benchmark-django-fastapi/blob/main/testdjango/asgi_with_static.py

I was thinking these but with gunicorn --workers 18 .... on 14 heroku Performance L instances, and scaling down to 7

https://devcenter.heroku.com/articles/dyno-types

seems like django 3.2 served with uvicorn under peak load is twice as slow in a production environment ...
pretty spiky to 4x slower in comparison to using gunicorn and eventlet
with the same number of web workers ( 7 heroku Performance L )

Attachments (1)

Screenshot from 2021-05-21 12-56-13.png (101.6 KB ) - added by allen-munsch 3 years ago.
picture of performance metrics compared to last week

Download all attachments as: .zip

Change History (5)

by allen-munsch, 3 years ago

picture of performance metrics compared to last week

comment:1 by allen-munsch, 3 years ago

Description: modified (diff)

comment:2 by Mariusz Felisiak, 3 years ago

Description: modified (diff)
Resolution: invalid
Status: newclosed

Ticket description contains a lot of support questions. Please use one of support channels.

comment:3 by allen-munsch, 3 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top