Skip to content

Commit 3182d1c

Browse files
committed
Merge pull request #3589 from mboersma/rightsize-gunicorn
feat(controller): allow user to scale gunicorn worker processes
2 parents 4b6cc67 + e8a77cf commit 3182d1c

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

controller/conf.d/gconf.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[template]
2+
src = "gconf.py"
3+
dest = "/app/deis/gconf.py"
4+
uid = 1000
5+
gid = 1000
6+
mode = "0640"
7+
keys = [
8+
"/deis/controller",
9+
]
10+
reload_cmd = "/app/bin/reload"
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
bind = '0.0.0.0'
2-
workers = 8
2+
try:
3+
workers = int({{ if exists "/deis/controller/workers" }}{{ getv "/deis/controller/workers" }}{{ else }}"not set"{{end}})
4+
except (NameError, ValueError):
5+
import multiprocessing
6+
try:
7+
workers = multiprocessing.cpu_count() * 2 + 1
8+
except NotImplementedError:
9+
workers = 8
310
proc_name = 'deis-controller'
411
timeout = 1200
512
pidfile = '/tmp/gunicorn.pid'

docs/customizing_deis/controller_settings.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ setting description
4141
==================================== ======================================================
4242
/deis/controller/registrationMode set registration to "enabled", "disabled", or "admin_only" (default: "enabled")
4343
/deis/controller/webEnabled enable controller web UI (default: false)
44+
/deis/controller/workers number of web worker processes (default: CPU cores * 2 + 1)
4445
/deis/cache/host host of the cache component (set by cache)
4546
/deis/cache/port port of the cache component (set by cache)
4647
/deis/database/host host of the database component (set by database)

0 commit comments

Comments
 (0)