Default worker-count in Docker: min(cpu_count, 4) instead of 1

As per discussion with @sekrause on #101

Briefly: recent reduction is a good idea, but 1 is probably too
little.
This commit is contained in:
Klaas van Schelven
2025-05-18 11:18:54 +02:00
parent b58058ccd1
commit ab7ad72376
4 changed files with 10 additions and 5 deletions

View File

@@ -5,10 +5,10 @@
### Backwards-incompatible changes
* The default number of web processes (gunicorn server workers) in the
dockerized setup is now 1 (it used to be 10).
dockerized setup is now equal to `min(cpu_count, 4)`; (it used to be 10).
set `WEB_CONCURRENCY=...` or `GUNICORN_CMD_ARGS="--workers=..."` to
restore the previous behavior or choose a custom number.
set `GUNICORN_CMD_ARGS="--workers=..."` to restore the previous behavior or
choose a custom number.
### ...

View File

@@ -51,4 +51,4 @@ RUN ["bugsink-manage", "migrate", "snappea", "--database=snappea"]
HEALTHCHECK CMD python -c 'import requests; requests.get("http://localhost:8000/health/ready").raise_for_status()'
CMD [ "monofy", "bugsink-manage", "check", "--deploy", "--fail-level", "WARNING", "&&", "bugsink-manage", "migrate", "&&", "bugsink-manage", "prestart", "&&", "gunicorn", "--bind=0.0.0.0:$PORT", "--access-logfile", "-", "bugsink.wsgi", "|||", "bugsink-runsnappea"]
CMD [ "monofy", "bugsink-manage", "check", "--deploy", "--fail-level", "WARNING", "&&", "bugsink-manage", "migrate", "&&", "bugsink-manage", "prestart", "&&", "gunicorn", "--config", "gunicorn.docker.conf.py", "--bind=0.0.0.0:$PORT", "--access-logfile", "-", "bugsink.wsgi", "|||", "bugsink-runsnappea"]

View File

@@ -71,9 +71,10 @@ RUN --mount=type=cache,target=/var/cache/buildkit/pip \
pip install /wheels/$WHEEL_FILE
COPY bugsink/conf_templates/docker.py.template bugsink_conf.py
COPY gunicorn.docker.conf.py /app/
RUN ["bugsink-manage", "migrate", "snappea", "--database=snappea"]
HEALTHCHECK CMD python -c 'import requests; requests.get("http://localhost:8000/health/ready").raise_for_status()'
CMD [ "monofy", "bugsink-manage", "check", "--deploy", "--fail-level", "WARNING", "&&", "bugsink-manage", "migrate", "&&", "bugsink-manage", "prestart", "&&", "gunicorn", "--bind=0.0.0.0:$PORT", "--access-logfile", "-", "bugsink.wsgi", "|||", "bugsink-runsnappea"]
CMD [ "monofy", "bugsink-manage", "check", "--deploy", "--fail-level", "WARNING", "&&", "bugsink-manage", "migrate", "&&", "bugsink-manage", "prestart", "&&", "gunicorn", "--config", "gunicorn.docker.conf.py", "--bind=0.0.0.0:$PORT", "--access-logfile", "-", "bugsink.wsgi", "|||", "bugsink-runsnappea"]

4
gunicorn.docker.conf.py Normal file
View File

@@ -0,0 +1,4 @@
# gunicorn config file for Docker deployments
import multiprocessing
workers = min(multiprocessing.cpu_count(), 4)