##// END OF EJS Templates
config: updated example gunicorn configuration.
marcink -
r1365:ac27c3de default
parent child Browse files
Show More
@@ -1,4 +1,17 b''
1 """gunicorn config hooks"""
1 """
2 gunicorn config extension and hooks. Sets additional configuration that is
3 available post the .ini config.
4
5 - workers = ${cpu_number}
6 - threads = 1
7 - proc_name = ${gunicorn_proc_name}
8 - worker_class = sync
9 - worker_connections = 10
10 - max_requests = 1000
11 - max_requests_jitter = 30
12 - timeout = 21600
13
14 """
2 15
3 16 import multiprocessing
4 17 import sys
@@ -6,50 +19,31 b' import threading'
6 19 import traceback
7 20
8 21
9 # GLOBAL #
22 # GLOBAL
10 23 errorlog = '-'
11 24 accesslog = '-'
12 25 loglevel = 'debug'
13 26
14 # SECURITY #
27 # SECURITY
15 28 limit_request_line = 4094
16 29 limit_request_fields = 100
17 30 limit_request_field_size = 8190
18 31
19 # SERVER MECHANICS #
20 # None == system temp dir #
32 # SERVER MECHANICS
33 # None == system temp dir
21 34 worker_tmp_dir = None
22 35 tmp_upload_dir = None
23 #proc_name =
24
25 # self adjust workers based on CPU #
26 #workers = multiprocessing.cpu_count() * 2 + 1
27
28 access_log_format = '[%(p)s] %(h)15s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s" request_time:%(L)s'
29
30 # For the gevent worker classes #
31 # this limits the maximum number of simultaneous clients that #
32 # a single process can handle. #
33 #worker_connections = 10
34 36
35 # Max requests to handle by each worker before restarting it, #
36 # could prevent memory leaks #
37 #max_requests = 1000
38 #max_requests_jitter = 30
39
37 # Custom log format
38 access_log_format = (
39 '%(t)s GNCRN %(p)-8s %(h)-15s rqt:%(L)s %(s)s %(b)s "%(m)s:%(U)s %(q)s" usr:%(u)s "%(f)s" "%(a)s"')
40 40
41 # If a worker does not notify the master process in this #
42 # number of seconds it is killed and a new worker is spawned #
43 # to replace it. #
44 #timeout = 3600
45
46 access_log_format = (
47 '[%(p)-10s] %(h)s time:%(L)s %(l)s %(u)s '
48 '%(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"')
41 # self adjust workers based on CPU count
42 # workers = multiprocessing.cpu_count() * 2 + 1
49 43
50 44
51 45 def post_fork(server, worker):
52 server.log.info("[<%s>] worker spawned", worker.pid)
46 server.log.info("[<%-10s>] WORKER spawned", worker.pid)
53 47
54 48
55 49 def pre_fork(server, worker):
@@ -67,7 +61,7 b' def when_ready(server):'
67 61 def worker_int(worker):
68 62 worker.log.info("[<%-10s>] worker received INT or QUIT signal", worker.pid)
69 63
70 # get traceback info
64 # get traceback info, on worker crash
71 65 id2name = dict([(th.ident, th.name) for th in threading.enumerate()])
72 66 code = []
73 67 for thread_id, stack in sys._current_frames().items():
General Comments 0
You need to be logged in to leave comments. Login now