question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[QUESTION] Use uvicorn or gunicorn in docker CMD

See original GitHub issue

First check

  • I used the GitHub search to find a similar issue and didn’t find it.
  • I searched the FastAPI documentation, with the integrated search.
  • I already searched in Google “How to X in FastAPI” and didn’t find any information.

Description

I read the document Deployment

截屏2020-04-14 下午4 55 27

The CMD runs in docker use uvicorn,why not gunicorn? Which should i use for best performance?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
Zheaolicommented, Apr 15, 2020

@luozhouyang this just let people to use both uvicorn and gunicorn bu using the same image to adapt different circumstance

0reactions
tiangolocommented, Apr 25, 2020

Thanks for the help here everyone! 👏 🙇

Thanks for reporting back and closing the issue @luozhouyang 👍

About the Docker image, in short, Gunicorn starts several Uvicorn workers, it makes sure there are several processes ready to work. And each of those Uvicorn workers do the actual work.

You can read more in the docs for the Docker image: https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker

Read more comments on GitHub >

github_iconTop Results From Across the Web

Running FastAPI in docker with uvicorn and gunicorn nginx
Gunicorn and uvicorn services are started using supervisord. python is installed in a virtual environment located in /opt/venv. Dockerfile FROM ...
Read more >
Server Workers - Gunicorn with Uvicorn - FastAPI
You can use Gunicorn (or also Uvicorn) as a process manager with Uvicorn workers to take advantage of multi-core CPUs, to run multiple...
Read more >
How to Build a Django and Gunicorn Application with Docker
Interested in Django but not sure where to start with Docker? This tutorial will walk you through first steps: modifying a sample Django ......
Read more >
The Ultimate FastAPI Tutorial Part 13 - Using Docker to ...
Why use Gunicorn with Uvicorn? ... Uvicorn provides a lightweight way to run multiple worker processes, for example --workers 4 , but does...
Read more >
Docker Best Practices for Python Developers - TestDriven.io
This is very inefficient, especially when using a Docker container as a ... string (shell) CMD "gunicorn -w 4 -k uvicorn.workers.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found