-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Paul Bui-Quang <[email protected]>
- Loading branch information
1 parent
2ec766f
commit 4f284bc
Showing
3 changed files
with
33 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Reference: https://github.com/benoitc/gunicorn/blob/master/examples/example_config.py | ||
|
||
import multiprocessing | ||
import os | ||
|
||
bind = "0.0.0.0:5000" | ||
|
||
""" | ||
Gunicorn relies on the operating system to provide all of the load balancing | ||
when handling requests. Generally we recommend (2 x $num_cores) + 1 | ||
as the number of workers to start off with. While not overly scientific, | ||
the formula is based on the assumption that for a given core, | ||
one worker will be reading or writing from the socket | ||
while the other worker is processing a request. | ||
https://docs.gunicorn.org/en/stable/design.html#how-many-workers | ||
""" | ||
|
||
workers = os.getenv("GUNICORN_WORKERS") | ||
if workers == "ALL_AVAILABLE" or workers is None: | ||
workers = multiprocessing.cpu_count() * 2 + 1 | ||
|
||
timeout = 10 * 60 # 10 minutes | ||
keepalive = 24 * 60 * 60 # 1 day | ||
|
||
capture_output = True | ||
|
||
loglevel = "info" | ||
errorlog = "-" | ||
accesslog = "-" | ||
preload_app = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,4 +22,5 @@ starlette~=0.14.2 | |
locust~=1.5.1 | ||
MarkupSafe~=1.1.1 | ||
checksumdir~=1.2.0 | ||
pydantic~=1.8.2 | ||
pydantic~=1.8.2 | ||
gunicorn |