From 04b2b884379bd63d94d7abde0f6d626dc9b23f34 Mon Sep 17 00:00:00 2001 From: Adrian Priestley Date: Thu, 2 Jan 2025 15:15:18 -0330 Subject: [PATCH] feat(deploy): Updated gunicorn configuration example - Adjusted worker and thread counts - Switched worker class from sync to gthread - Changed log level to info - Added example code snippet for customizing worker count --- deploy/example_gunicorn.conf.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/deploy/example_gunicorn.conf.py b/deploy/example_gunicorn.conf.py index 1c9cb6ca33..4faaef80bf 100644 --- a/deploy/example_gunicorn.conf.py +++ b/deploy/example_gunicorn.conf.py @@ -1,11 +1,19 @@ -import multiprocessing - -workers = multiprocessing.cpu_count() * 2 + 1 +workers = 2 +threads = 2 wsgi_app = "WebHost:get_app()" accesslog = "-" access_log_format = ( '%({x-forwarded-for}i)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"' ) -worker_class = "sync" # "sync" | eventlet" | "gevent" | "tornado" +worker_class = "gthread" # "sync" | "gthread" | eventlet" | "gevent" | "tornado" forwarded_allow_ips = "*" -loglevel = "debug" +loglevel = "info" + +""" +You can programatically set values. +For example, set number of workers to half of the cpu count: + +import multiprocessing + +workers = multiprocessing.cpu_count() / 2 +"""