From 0d476546516eaf30c2b5a256035c15be346e0f21 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 26 Jan 2022 10:04:58 +0100 Subject: [PATCH] root: add max-requests for gunicorn and max tasks for celery Signed-off-by: Jens Langhammer --- authentik/root/settings.py | 1 + lifecycle/gunicorn.conf.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/authentik/root/settings.py b/authentik/root/settings.py index 707fd9c10..fc17f16aa 100644 --- a/authentik/root/settings.py +++ b/authentik/root/settings.py @@ -347,6 +347,7 @@ LOCALE_PATHS = ["./locale"] # Celery settings # Add a 10 minute timeout to all Celery tasks. CELERY_TASK_SOFT_TIME_LIMIT = 600 +CELERY_WORKER_MAX_TASKS_PER_CHILD = 50 CELERY_BEAT_SCHEDULE = { "clean_expired_models": { "task": "authentik.core.tasks.clean_expired_models", diff --git a/lifecycle/gunicorn.conf.py b/lifecycle/gunicorn.conf.py index f2de67276..3f36d5e31 100644 --- a/lifecycle/gunicorn.conf.py +++ b/lifecycle/gunicorn.conf.py @@ -23,6 +23,9 @@ if os.path.exists("/dev/shm"): # nosec os.environ.setdefault("DJANGO_SETTINGS_MODULE", "authentik.root.settings") +max_requests = 1000 +max_requests_jitter = 50 + logconfig_dict = { "version": 1, "disable_existing_loggers": False,