-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Enable gevent worker in gunicorn - Enable psycogreen in dci-cs to take full advantage of gevent - Only *try* to enable psycogreen if it can be imported. Don't make it a hard failure (current deployment in mod_wsgi won't have psycogreen) - Use only one worker in gunicorn, scaling will be handled by creating more containers and let haproxy do the load balancing - Clean all RPMs required only at build time - Some gunicorn tuning Change-Id: Ica635b755dad27ca7f53e39423290f866ba6d372
- Loading branch information
Showing
4 changed files
with
34 additions
and
6 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
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 |
---|---|---|
@@ -1,6 +1,23 @@ | ||
import multiprocessing | ||
import os | ||
|
||
default_nb_workers = multiprocessing.cpu_count() * 2 + 1 | ||
workers = int(os.getenv("DCI_NB_WORKERS", default_nb_workers)) | ||
# Don't manage workers with gunicorn but by spawning more containers and let haproxy handle balancing | ||
DEFAULT_NB_WORKERS = 1 | ||
workers = int(os.getenv("DCI_NB_WORKERS", DEFAULT_NB_WORKERS)) | ||
worker_connections = int(os.getenv("DCI_GUNICORN_WORKER_CONNECTIONS", 50)) | ||
worker_class = "gevent" | ||
|
||
# Restart worker after a certain amount of requests to mitigate memory leaks, etc. … | ||
max_requests = 1000 | ||
# Add some jitter to avoid all workers restarting at the same time. | ||
max_requests_jitter = 250 | ||
|
||
accesslog = "-" | ||
access_log_format = ( | ||
'%(h)s:%({x-forwarded-for}i)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"' | ||
) | ||
|
||
# Some default values from gunicorn that might be of interest to tune | ||
# max_connections = 1000 | ||
# backlog = 2048 | ||
# timeout = 30 | ||
# graceful_timeout = 30 |
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