From 6e3d376eef1a7ef14f81cef8eb866197fffa5689 Mon Sep 17 00:00:00 2001 From: catborise Date: Sun, 8 Nov 2026 16:02:13 +0300 Subject: [PATCH] build(docker): gunicorn runs 4 workers in the image gunicorn.conf.py starts 2 x CPUs + 1 workers, at most 8, about 140 MB each: 1.1 GB on the deployed host for a panel. The image now runs 4, which still sends up to 8 requests at a time to one compute and leaves threads for the others when one hangs. GUNICORN_CMD_ARGS in docker-compose.override.yml sets another number; installs outside Docker keep their default. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea --- Dockerfile | 3 +++ README.md | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 08d89026..ccb23460 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,6 +44,9 @@ RUN --mount=type=cache,target=/root/.cache/pip \ FROM base +# 4 gunicorn workers of 4 threads (about 140 MB each); docker-compose.override.yml can set another number +ENV GUNICORN_CMD_ARGS="--workers 4" + COPY --from=build /srv/webvirtcloud/venv venv COPY . . diff --git a/README.md b/README.md index 253a3314..1f2ff403 100644 --- a/README.md +++ b/README.md @@ -369,7 +369,7 @@ services: The container makes the file the panel user's (uid 33) with mode 600; edit it as root. -gunicorn runs at most 8 workers (fewer on hosts with under 4 CPUs) of 4 threads each; to change it, set `GUNICORN_CMD_ARGS=--workers N` in a drop-in of `webvirt-cloud` (`systemctl edit webvirt-cloud`: `[Service]` and `Environment="GUNICORN_CMD_ARGS=--workers N"`) or in `docker-compose.override.yml`. +gunicorn runs at most 8 workers (fewer on hosts with under 4 CPUs), in Docker 4, of 4 threads each; each worker takes about 140 MB and sends at most 2 requests at a time to one compute. To change it, set `GUNICORN_CMD_ARGS=--workers N` in a drop-in of `webvirt-cloud` (`systemctl edit webvirt-cloud`: `[Service]` and `Environment="GUNICORN_CMD_ARGS=--workers N"`) or in `docker-compose.override.yml`. ### HTTPS and reverse proxy