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

Suggesting using existing process manager in docs #2177

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion docs/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,14 @@ A process manager will handle the socket setup, start-up multiple server process

Uvicorn provides a lightweight way to run multiple worker processes, for example `--workers 4`, but does not provide any process monitoring.

### Using cloud provider process manager

Modern deployments often are deployed on a Softare as a Service platform or a Platform as a Service.
Examples include various offerings from AWS, GCP, Render, fly.io and Kubernetes (available as a service on many cloud providers).
These are just examples, Uvicorn does not necessarily recommend or endorse any of these above other options.
Kubernetes for example functions both as a process manager and load balancer.
These options can range form simple to complex, and they may not be better than other options listed below, but if you are already using Kubernetes or another option that offers load balancing and process maangement you do not need to also run your own process manager and load balancer.

### Gunicorn

Gunicorn is probably the simplest way to run and manage Uvicorn in a production setting. Uvicorn includes a gunicorn worker class that means you can get set up with very little configuration.
Expand All @@ -192,7 +200,7 @@ The `UvicornWorker` implementation uses the `uvloop` and `httptools` implementat

`gunicorn -w 4 -k uvicorn.workers.UvicornH11Worker`

Gunicorn provides a different set of configuration options to Uvicorn, so some options such as `--limit-concurrency` are not yet supported when running with Gunicorn.
Gunicorn provides a different set of configuration options to Uvicorn, so some options such as `--limit-concurrency` are not yet supported when running with Gunicorn.

If you need to pass uvicorn's config arguments to gunicorn workers then you'll have to subclass `UvicornWorker`:

Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ fully-featured process management.
This allows you to increase or decrease the number of worker processes on the
fly, restart worker processes gracefully, or perform server upgrades without downtime.

For production deployments we recommend using gunicorn with the uvicorn worker class.
If you need multiple workers process, for example if your CPU has multiple cores, you can run Uvicorn with Gunicorn workers as follows:

```
gunicorn example:app -w 4 -k uvicorn.workers.UvicornWorker
Expand Down