# HG changeset patch # User RhodeCode Admin # Date 2023-08-16 07:26:43 # Node ID 7050b122639206990f8e11fe97d80a3360d9ca93 # Parent 755d25a94200ef7d9d39cfa4afc95eb61c1dcfe0 gunicorn: print config on startup diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -67,7 +67,7 @@ dev-srv: .PHONY: dev-srv-g ## run gunicorn multi process workers dev-srv-g: - gunicorn --workers=4 --paste .dev/dev.ini --bind=0.0.0.0:10010 --worker-class=sync --threads=1 --config=configs/gunicorn_config.py --timeout=120 + gunicorn --workers=4 --paste .dev/dev.ini --bind=0.0.0.0:10010 --config=.dev/gunicorn_config.py # Default command on calling make .DEFAULT_GOAL := show-help diff --git a/configs/gunicorn_config.py b/configs/gunicorn_config.py --- a/configs/gunicorn_config.py +++ b/configs/gunicorn_config.py @@ -116,13 +116,14 @@ keepalive = 2 # graceful restart signal 0 = memory monitoring is disabled # Examples: 268435456 (256MB), 536870912 (512MB) # 1073741824 (1GB), 2147483648 (2GB), 4294967296 (4GB) +# Dynamic formula 1024 * 1024 * 256 == 256MBs memory_max_usage = 0 # How often in seconds to check for memory usage for each gunicorn worker memory_usage_check_interval = 60 # Threshold value for which we don't recycle worker if GarbageCollection -# frees up enough resources. Before each restart we try to run GC on worker +# frees up enough resources. Before each restart, we try to run GC on worker # in case we get enough free memory after that, restart will not happen. memory_usage_recovery_threshold = 0.8 @@ -229,6 +230,9 @@ def pre_exec(server): def on_starting(server): server_lbl = '{} {}'.format(server.proc_name, server.address) server.log.info("Server %s is starting.", server_lbl) + server.log.info('Config:') + server.log.info(f"\n{server.cfg}") + server.log.info(get_memory_usage_params()) def when_ready(server):