forked from learningequality/kolibri-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hashi_uwsgi.ini
51 lines (45 loc) · 2.82 KB
/
hashi_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
[uwsgi]
# Sources used to create this configuration file:
# https://uwsgi-docs.readthedocs.io/en/latest/Options.html
# https://uwsgi-docs.readthedocs.io/en/latest/ThingsToKnow.html
# https://www.reddit.com/r/Python/comments/4s40ge/understanding_uwsgi_threads_processes_and_gil/
# https://www.techatbloomberg.com/blog/configuring-uwsgi-production-deployment/
socket = /tmp/kolibri_hashi_uwsgi.sock
chmod-socket = 660
gid = www-data
#chown-socket = $(KOLIBRI_USER):www-data
chdir = /usr/lib/python3/dist-packages/
pythonpath = /usr/lib/python3/dist-packages/kolibri/dist
master = true # https://uwsgi-docs.readthedocs.io/en/latest/Glossary.html?highlight=master
harakiri = 5000 # https://uwsgi-docs.readthedocs.io/en/latest/FAQ.html#what-is-harakiri-mode
enable-threads = false
cpu-affinity = 1 # Set the number of cores (CPUs) to allocate to each worker process
listen = 100 # Set the socket listen queue size. When this queue is full, requests will be rejected.
# rawrouter-buffer-size = 16392 # set internal buffer size
limit-as = 1024 # limit processes address space/vsz
reload-on-rss = 512 # reload if rss memory is higher than specified megabytes
no-orphans = true # automatically kill workers if master dies
reload-mercy = 4 # set the maximum time (in seconds) we wait for workers and other processes to die during reload/shutdown
plugin = python3
max-requests = 1000 # Reload workers after the specified amount of managed requests (avoid memory leaks).
vacuum = True # Try to remove all of the generated files/sockets (UNIX sockets and pidfiles) upon exit.
module = kolibri.deployment.default.alt_wsgi:alt_application
buffer-size = 8192 # needed to support long requests blocks (in lessons, for example)
wsgi-disable-file-wrapper = true # needed to fix uwsgi bug https://github.com/unbit/uwsgi/issues/1126
single-interpreter = true
die-on-term = true # Shutdown when receiving SIGTERM (default is respawn)
need-app = true
disable-logging = true # Disable built-in logging
log-4xx = true # but log 4xx's anyway
log-5xx = true # and 5xx's
py-callos-afterfork = true # allow workers to trap signals
max-requests = 1000 # Restart workers after this many requests
max-worker-lifetime = 3600 # Restart workers after this many seconds
worker-reload-mercy = 60 # How long to wait before forcefully killing workers
# algorithm to scale automatically:
cheaper-algo = spare # set cheaper algorithm to use, if not set default will be used
cheaper = 2 # minimum number of workers to keep at all times
cheaper-initial = 3 # number of workers to spawn at startup
workers = 16 # maximum number of workers that can be spawned
cheaper-step = 1 # how many workers should be spawned at a time
manage-script-name = true