fix(api): recycle gunicorn workers to cap memory growth (#13047)

This commit is contained in:
César Arroba authored and GitHub committed 2026-10-15 09:36:33 +02:00
1 parent d8a4e98850
commit 1f8ca695e8
2 files changed
+5

No files matched your search

@@ -0,0 +1 @@
Gunicorn workers are now recycled after 10000 requests (plus up to 1000 of jitter) to cap memory growth, configurable with `GUNICORN_MAX_REQUESTS` and `GUNICORN_MAX_REQUESTS_JITTER`
+4
View File
@@ -53,6 +53,10 @@ preload_app = not DEBUG
# that may take longer, such as complex API operations.
timeout = env.int("GUNICORN_TIMEOUT", default=120)
# Recycle workers after N requests (+ jitter) to cap memory growth. GUNICORN_MAX_REQUESTS=0 disables.
max_requests = env.int("GUNICORN_MAX_REQUESTS", default=10000)
max_requests_jitter = env.int("GUNICORN_MAX_REQUESTS_JITTER", default=1000)
# Logging
logconfig_dict = DJANGO_LOGGERS
gunicorn_logger = logging.getLogger(BackendLogger.GUNICORN)