From 2382d77bbaf23631d757b1848ad60ce5c6d53ff6 Mon Sep 17 00:00:00 2001 From: Adrian Garcia Badaracco <1755071+adriangb@users.noreply.github.com> Date: Tue, 5 Dec 2023 10:00:13 +0300 Subject: [PATCH 1/3] Suggesting using existing process manager in docs --- docs/deployment.md | 10 +++++++++- docs/index.md | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/deployment.md b/docs/deployment.md index 58927d95e..8d83f8b84 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -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 (availble 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. @@ -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`: diff --git a/docs/index.md b/docs/index.md index a129e7a52..9f2275c6a 100644 --- a/docs/index.md +++ b/docs/index.md @@ -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 gunicorn with uvicorn workers as follows: ``` gunicorn example:app -w 4 -k uvicorn.workers.UvicornWorker From 7c33bea456a9a4fd5ea375b2cb9d3fd6ffbc83da Mon Sep 17 00:00:00 2001 From: Marcelo Trylesinski Date: Tue, 5 Dec 2023 00:01:32 -0700 Subject: [PATCH 2/3] Update docs/deployment.md --- docs/deployment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/deployment.md b/docs/deployment.md index 8d83f8b84..b0cac0b49 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -183,7 +183,7 @@ Uvicorn provides a lightweight way to run multiple worker processes, for example ### 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 (availble as a service on many cloud providers). +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. From dcaf4799363c9ffd76e4959a22b660bf32995687 Mon Sep 17 00:00:00 2001 From: Adrian Garcia Badaracco <1755071+adriangb@users.noreply.github.com> Date: Tue, 5 Dec 2023 01:01:54 -0600 Subject: [PATCH 3/3] Update docs/index.md --- docs/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.md b/docs/index.md index 9f2275c6a..d10935118 100644 --- a/docs/index.md +++ b/docs/index.md @@ -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. -If you need multiple workers process, for example if your CPU has multiple cores, you can run gunicorn with uvicorn workers as follows: +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