From 2c4f7c69683e8cfd66d51c0300afa0b912b34bd7 Mon Sep 17 00:00:00 2001 From: Michal Konecny Date: Wed, 3 Jul 2024 17:02:51 +0200 Subject: [PATCH] [mailman3] Improve the gunicorn setup Use the recommended CPU*2+1 amount of workers and limit max requests done. After that the gunicorn reloads itself and free up all the memory. Signed-off-by: Michal Konecny --- roles/mailman3/defaults/main.yml | 2 +- roles/mailman3/templates/mailmanweb.service.j2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/mailman3/defaults/main.yml b/roles/mailman3/defaults/main.yml index cdb828b0b7..3bf7a620fd 100644 --- a/roles/mailman3/defaults/main.yml +++ b/roles/mailman3/defaults/main.yml @@ -29,7 +29,7 @@ mailman_hyperkitty_admin_db_pass: changeme mailman_hyperkitty_db_pass: changeme mailman_hyperkitty_cookie_key: changeme mailman_hyperkitty_archiver_key: changeme -mailman_gunicorn_workers: 9 +mailman_gunicorn_workers: {{ num_cpus * 2 + 1 }} mailman_domains: - lists.example.com - lists.example.org diff --git a/roles/mailman3/templates/mailmanweb.service.j2 b/roles/mailman3/templates/mailmanweb.service.j2 index 157e902ad9..ff45926468 100644 --- a/roles/mailman3/templates/mailmanweb.service.j2 +++ b/roles/mailman3/templates/mailmanweb.service.j2 @@ -11,5 +11,5 @@ Type=simple User=mailman Group=mailman WorkingDirectory=/etc/mailman3 -ExecStart=/usr/bin/gunicorn --timeout 1000 --workers={{ mailman_gunicorn_workers }} --forwarded-allow-ips="*" mailman_web.wsgi +ExecStart=/usr/bin/gunicorn --max-requests 50000 --timeout 1000 --workers={{ mailman_gunicorn_workers }} --forwarded-allow-ips="*" mailman_web.wsgi ExecStop=/bin/kill -s TERM $MAINPID