From 13a8ad31268c639d11db9f247522dc0ee1ee5f8e Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 4 Aug 2021 21:37:13 +0200 Subject: [PATCH] lifecycle: decrease default worker count on compose Signed-off-by: Jens Langhammer --- lifecycle/gunicorn.conf.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lifecycle/gunicorn.conf.py b/lifecycle/gunicorn.conf.py index e03372481..211f78680 100644 --- a/lifecycle/gunicorn.conf.py +++ b/lifecycle/gunicorn.conf.py @@ -51,7 +51,8 @@ logconfig_dict = { if SERVICE_HOST_ENV_NAME in os.environ: workers = 2 else: - workers = int(os.environ.get("WORKERS", cpu_count() * 2 + 1)) + default_workers = max(cpu_count() * 0.25, 1) + 1 # Minimum of 2 workers + workers = int(os.environ.get("WORKERS", default_workers)) threads = 4 warnings.simplefilter("once")