diff --git a/configs/gunicorn_config.py b/configs/gunicorn_config.py --- a/configs/gunicorn_config.py +++ b/configs/gunicorn_config.py @@ -77,14 +77,14 @@ worker_connections = 10 # Max number of requests that worker will handle before being gracefully restarted. # Prevents memory leaks, jitter adds variability so not all workers are restarted at once. max_requests = 2000 -max_requests_jitter = 30 +max_requests_jitter = int(max_requests * 0.2) # 20% of max_requests # The maximum number of pending connections. # Exceeding this number results in the client getting an error when attempting to connect. backlog = 64 -# Amount of time a worker can spend with handling a request before it -# gets killed and restarted. By default set to 21600 (6hrs) +# The Amount of time a worker can spend with handling a request before it +# gets killed and restarted. By default, set to 21600 (6hrs) # Examples: 1800 (30min), 3600 (1hr), 7200 (2hr), 43200 (12h) timeout = 21600 @@ -124,7 +124,7 @@ 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 -# in case we get enough free memory after that, restart will not happen. +# in case we get enough free memory after that; restart will not happen. memory_usage_recovery_threshold = 0.8 @@ -322,7 +322,7 @@ def _check_memory_usage(worker): def worker_int(worker): worker.log.info("pid=[%-10s] worker received INT or QUIT signal", worker.pid) - # get traceback info, on worker crash + # get traceback info, when a worker crashes def get_thread_id(t_id): id2name = dict([(th.ident, th.name) for th in threading.enumerate()]) return id2name.get(t_id, "unknown_thread_id")