From b5cabbb3c8db2f2f896aa88dc3d0cb67e28f4059 Mon Sep 17 00:00:00 2001 From: ronardcaktus Date: Mon, 30 Oct 2023 15:57:02 +0000 Subject: [PATCH 1/2] Reload workers after a specified amount of requests --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index 5e4cfe83..37e61401 100644 --- a/Dockerfile +++ b/Dockerfile @@ -183,3 +183,6 @@ ENV PATH=/code/venv/bin:$PATH WORKDIR /code CMD ["python", "/code/manage.py", "runserver", "0.0.0.0:8000"] + +# Reload workers after the specified amount of managed requests (avoid memory leaks) +ENV UWSGI_MAX_REQUESTS=1000 From cbb63d0fae5a28308b2b84dae91d956738d70de5 Mon Sep 17 00:00:00 2001 From: ronardcaktus Date: Wed, 1 Nov 2023 13:38:20 -0400 Subject: [PATCH 2/2] Move max request up in file --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 37e61401..286cd651 100644 --- a/Dockerfile +++ b/Dockerfile @@ -85,6 +85,9 @@ ENV UWSGI_HTTP=:8000 UWSGI_MASTER=1 UWSGI_HTTP_AUTO_CHUNKED=1 UWSGI_HTTP_KEEPALI # Number of uWSGI workers and threads per worker (customize as needed): ENV UWSGI_WORKERS=2 UWSGI_THREADS=4 +# Reload workers after the specified amount of managed requests (avoid memory leaks) +ENV UWSGI_MAX_REQUESTS=1000 + # uWSGI static file serving configuration (customize or comment out if not needed): ENV UWSGI_STATIC_MAP="/static/=/code/static/" UWSGI_STATIC_EXPIRES_URI="/static/.*\.[a-f0-9]{12,}\.(css|js|png|jpg|jpeg|gif|ico|woff|ttf|otf|svg|scss|map|txt) 315360000" @@ -183,6 +186,3 @@ ENV PATH=/code/venv/bin:$PATH WORKDIR /code CMD ["python", "/code/manage.py", "runserver", "0.0.0.0:8000"] - -# Reload workers after the specified amount of managed requests (avoid memory leaks) -ENV UWSGI_MAX_REQUESTS=1000