-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathgunicorn.conf.py
More file actions
30 lines (20 loc) · 825 Bytes
/
gunicorn.conf.py
File metadata and controls
30 lines (20 loc) · 825 Bytes
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
import multiprocessing
def max_workers_and_threads() -> int:
"""
Compute recommended number of gunicorn workers and threads.
https://stackoverflow.com/questions/38425620/gunicorn-workers-and-threads
:return: recommended number of gunicorn workers and threads.
:rtype: int
"""
return multiprocessing.cpu_count() * 2 + 1
HOST = "0.0.0.0"
PORT = 5000
# GUNICORN OPTIONS
bind = f"{HOST}:{PORT}" # The socket to bind
workers = 1 # The number of worker processes for handling requests
threads = min( # The number of worker threads for handling requests
8, max_workers_and_threads()
)
timeout = 0 # Workers silent for more than this many seconds are killed and restarted
# You can also add other gunicorn options:
# https://docs.gunicorn.org/en/stable/configure.html#configuration-file