##// END OF EJS Templates
configs: improve gunicor config on worker_recycle logic
super-admin -
r5174:60fffd9c default
parent child Browse files
Show More
@@ -77,14 +77,14 b' worker_connections = 10'
77 # Max number of requests that worker will handle before being gracefully restarted.
77 # Max number of requests that worker will handle before being gracefully restarted.
78 # Prevents memory leaks, jitter adds variability so not all workers are restarted at once.
78 # Prevents memory leaks, jitter adds variability so not all workers are restarted at once.
79 max_requests = 2000
79 max_requests = 2000
80 max_requests_jitter = 30
80 max_requests_jitter = int(max_requests * 0.2) # 20% of max_requests
81
81
82 # The maximum number of pending connections.
82 # The maximum number of pending connections.
83 # Exceeding this number results in the client getting an error when attempting to connect.
83 # Exceeding this number results in the client getting an error when attempting to connect.
84 backlog = 64
84 backlog = 64
85
85
86 # Amount of time a worker can spend with handling a request before it
86 # The Amount of time a worker can spend with handling a request before it
87 # gets killed and restarted. By default set to 21600 (6hrs)
87 # gets killed and restarted. By default, set to 21600 (6hrs)
88 # Examples: 1800 (30min), 3600 (1hr), 7200 (2hr), 43200 (12h)
88 # Examples: 1800 (30min), 3600 (1hr), 7200 (2hr), 43200 (12h)
89 timeout = 21600
89 timeout = 21600
90
90
@@ -124,7 +124,7 b' memory_usage_check_interval = 60'
124
124
125 # Threshold value for which we don't recycle worker if GarbageCollection
125 # Threshold value for which we don't recycle worker if GarbageCollection
126 # frees up enough resources. Before each restart, we try to run GC on worker
126 # frees up enough resources. Before each restart, we try to run GC on worker
127 # in case we get enough free memory after that, restart will not happen.
127 # in case we get enough free memory after that; restart will not happen.
128 memory_usage_recovery_threshold = 0.8
128 memory_usage_recovery_threshold = 0.8
129
129
130
130
@@ -322,7 +322,7 b' def _check_memory_usage(worker):'
322 def worker_int(worker):
322 def worker_int(worker):
323 worker.log.info("pid=[%-10s] worker received INT or QUIT signal", worker.pid)
323 worker.log.info("pid=[%-10s] worker received INT or QUIT signal", worker.pid)
324
324
325 # get traceback info, on worker crash
325 # get traceback info, when a worker crashes
326 def get_thread_id(t_id):
326 def get_thread_id(t_id):
327 id2name = dict([(th.ident, th.name) for th in threading.enumerate()])
327 id2name = dict([(th.ident, th.name) for th in threading.enumerate()])
328 return id2name.get(t_id, "unknown_thread_id")
328 return id2name.get(t_id, "unknown_thread_id")
General Comments 0
You need to be logged in to leave comments. Login now