diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -126,7 +126,7 @@ dev-srv: .PHONY: dev-srv-g ## run gunicorn multi process workers dev-srv-g: - gunicorn --workers=4 --paste .dev/dev_g.ini --bind=0.0.0.0:10020 --worker-class=gevent --threads=1 --config=configs/gunicorn_config.py --timeout=120 + gunicorn --paste .dev/dev.ini --bind=0.0.0.0:10020 --config=.dev/gunicorn_config.py # Default command on calling make 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): @@ -324,7 +328,7 @@ def worker_int(worker): return id2name.get(t_id, "unknown_thread_id") code = [] - for thread_id, stack in sys._current_frames().items(): + for thread_id, stack in sys._current_frames().items(): # noqa code.append( "\n# Thread: %s(%d)" % (get_thread_id(thread_id), thread_id)) for fname, lineno, name, line in traceback.extract_stack(stack): diff --git a/configs/production.ini b/configs/production.ini --- a/configs/production.ini +++ b/configs/production.ini @@ -1,4 +1,3 @@ - ; ######################################### ; RHODECODE COMMUNITY EDITION CONFIGURATION @@ -263,10 +262,10 @@ file_store.storage_path = %(here)s/data/ archive_cache.store_dir = %(here)s/data/archive_cache ; The limit in GB sets how much data we cache before recycling last used, defaults to 10 gb -archive_cache.cache_size_gb = 10 +archive_cache.cache_size_gb = 40 ; By default cache uses sharding technique, this specifies how many shards are there -archive_cache.cache_shards = 10 +archive_cache.cache_shards = 4 ; ############# ; CELERY CONFIG