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

Use gunicorn in the Docker image? Uvicorn not advised in prod #48

Closed
jeffchuber opened this issue Oct 27, 2022 · 4 comments
Closed

Use gunicorn in the Docker image? Uvicorn not advised in prod #48

jeffchuber opened this issue Oct 27, 2022 · 4 comments
Assignees

Comments

@jeffchuber
Copy link
Contributor

jeffchuber commented Oct 27, 2022

https://fastapi.tiangolo.com/deployment/server-workers/

https://fastapi.tiangolo.com/deployment/server-workers/
https://fastapi.tiangolo.com/deployment/docker/#official-docker-image-with-gunicorn-uvicorn

Would need to think about how this would affect things being in-memory and making sure those could be shared.

@jeffchuber jeffchuber changed the title Use gunicorn in the Docker image? [CHR-36] Use gunicorn in the Docker image? Oct 27, 2022
@jeffchuber jeffchuber changed the title [CHR-36] Use gunicorn in the Docker image? [CHR-36] Use gunicorn in the Docker image? Uvicorn not advised in prod Oct 27, 2022
@jeffchuber jeffchuber changed the title [CHR-36] Use gunicorn in the Docker image? Uvicorn not advised in prod Use gunicorn in the Docker image? Uvicorn not advised in prod Oct 27, 2022
@levand
Copy link
Contributor

levand commented Oct 29, 2022

The main difference between Gunicorn and Uvicorn (as I understand it) is that Uvicorn is best as a single-worker model whereas Gunicorn has better performance and support for multiple workers, where each worker is its own python process.

So on a "traditional" server where you want parallel request processing by multiple isolated workers, Gunicorn or a Gunicorn+Uvicorn combo is going to perform better.

But if we're contemplating an MVP where the primary "hot" representation of the data is in-memory, then we can't have multiple workers, because multiple processes don't share memory. We'd end up with N diverging in-memory representations if we did that.

So Gunicorn only becomes relevant in a world where we have a "stateless" FastAPI server that's writing through each request to some shared-state persisted database incrementally. Which relates to the question you asked in #38 and does somewhat depend on the capabilities of DuckDB to support overlapping updates from multiple processes.

@jeffchuber
Copy link
Contributor Author

Close relation to #38 - definitely agree.

@jeffchuber
Copy link
Contributor Author

We could move forward with this now I believe. @levand

@jeffchuber
Copy link
Contributor Author

Moving to backlog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants