forked from CAVEconnectome/PyChunkedGraph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
uwsgi.ini
114 lines (80 loc) · 2.88 KB
/
uwsgi.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
[uwsgi]
socket = /tmp/uwsgi.sock
chown-socket = nginx:nginx
chmod-socket = 664
# Graceful shutdown on SIGTERM, see https://github.com/unbit/uwsgi/issues/849#issuecomment-118869386
hook-master-start = unix_signal:15 gracefully_kill_them_all
module = run
callable = application
uid = nginx
gid = nginx
env = HOME=/home/nginx
# Python venv
if-env = VIRTUAL_ENV
virtualenv = %(_)
endif =
### Worker scaling
# maximum number of workers
processes = 16
# https://uwsgi-docs.readthedocs.io/en/latest/Cheaper.html#busyness-cheaper-algorithm
cheaper-algo = busyness
# Time window for tracking average busyness
cheaper-overload = 20
# Number of idle cycles before stopping a worker
cheaper-busyness-multiplier = 3
# Minimum number of workers
cheaper = 8
# Start with 8 workers
cheaper-initial = 8
# Spawn at most 8 workers at once
cheaper-step = 8
# Start spawning more workers at 60% busyness
cheaper-busyness-max = 60
# Start killing workers if busyness falls below 20%
cheaper-busyness-min = 20
### Reloads and limitations
# max socket listen queue length - requires net.somaxconn increase
listen = 4096
# Max request header size
buffer-size = 65535
# Don't spawn new workers if total memory over 6 GiB
cheaper-rss-limit-soft = 6442450944
# Reload worker after serving X requests
max-requests = 5000
# Grace period for single worker to reload/shutdown
worker-reload-mercy = 600
# Grace period for all workers and processes to reload/shutdown
reload-mercy = 605
# Kill stuck/unresponsive processes after 20 minutes
harakiri = 1200
### Misc
# Maintain Python thread support
enable-threads = true
# Required for cheaper-rss-limit-soft
memory-report = true
# Additional log output for harakiri
harakiri-verbose = true
### Logging
# Filter our properly pre-formated app messages and pass them through
logger = app stdio
log-route = app ^{.*"source":.*}$
# Capture known / most common uWSGI messages
logger = uWSGIdebug stdio
logger = uWSGIwarn stdio
log-route = uWSGIdebug ^{address space usage
log-route = uWSGIwarn \[warn\]
log-encoder = json:uWSGIdebug {"source":"uWSGI","time":"${strftime:%Y-%m-%dT%H:%M:%S.000Z}","severity":"debug","message":"${msg}"}
log-encoder = nl:uWSGIdebug
log-encoder = json:uWSGIwarn {"source":"uWSGI","time":"${strftime:%Y-%m-%dT%H:%M:%S.000Z}","severity":"warning","message":"${msg}"}
log-encoder = nl:uWSGIwarn
# Treat everything else as error message of unknown origin
logger = unknown stdio
# Creating our own "inverse Regex" using negative lookaheads, which makes this
# log-route rather cryptic and slow... Unclear how to get a simple
# "fall-through" behavior for non-matching messages, otherwise.
log-route = unknown ^(?:(?!^{address space usage|\[warn\]|^{.*"source".*}$).)*$
log-encoder = json:unknown {"source":"unknown","time":"${strftime:%Y-%m-%dT%H:%M:%S.000Z}","severity":"error","message":"${msg}"}
log-encoder = nl:unknown
log-4xx = true
log-5xx = true
disable-logging = true