Auto-configure WSGI worker processes

Automatically configure WSGI worker processes inline with other
charms using the worker-multiplier configuration option and the
WSGI worker configuration context from charm-helpers.

Change-Id: Ib8af4a5a54fcff13a05ba4f4094bf123d5282c4a
This commit is contained in:
James Page 2018-03-14 17:42:56 +00:00
parent fe209e82d2
commit c35faf4cbc
6 changed files with 17 additions and 6 deletions

View File

@ -348,3 +348,12 @@ options:
.
If not provided, leave the option unconfigured which enables all of the
above.
worker-multiplier:
type: float
default:
description: |
The CPU core multiplier to use when configuring worker processes for
Horizon. By default, the number of workers for each daemon is set to
twice the number of CPU cores a service unit has. When deployed in
a LXD container, this default value will be capped to 4 workers
unless this configuration option is set.

View File

@ -98,12 +98,14 @@ CONFIG_FILES = OrderedDict([
}),
(APACHE_CONF, {
'hook_contexts': [horizon_contexts.HorizonContext(),
context.SyslogContext()],
context.SyslogContext(),
context.WSGIWorkerConfigContext()],
'services': ['apache2', 'memcached'],
}),
(APACHE_24_CONF, {
'hook_contexts': [horizon_contexts.HorizonContext(),
context.SyslogContext()],
context.SyslogContext(),
context.WSGIWorkerConfigContext()],
'services': ['apache2', 'memcached'],
}),
(APACHE_SSL, {

View File

@ -1,5 +1,5 @@
WSGIScriptAlias {{ webroot }} /usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi
WSGIDaemonProcess horizon user=horizon group=horizon processes=3 threads=10
WSGIDaemonProcess horizon user=horizon group=horizon processes={{ processes }} threads=10
WSGIProcessGroup horizon
Alias /static /usr/share/openstack-dashboard/openstack_dashboard/static/
Alias /horizon/static /usr/share/openstack-dashboard/openstack_dashboard/static/

View File

@ -1,5 +1,5 @@
WSGIScriptAlias {{ webroot }} /usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi
WSGIDaemonProcess horizon user=horizon group=horizon processes=3 threads=10
WSGIDaemonProcess horizon user=horizon group=horizon processes={{ processes }} threads=10
WSGIProcessGroup horizon
Alias /static /usr/share/openstack-dashboard/openstack_dashboard/static/
Alias /horizon/static /usr/share/openstack-dashboard/openstack_dashboard/static/

View File

@ -1,5 +1,5 @@
WSGIScriptAlias {{ webroot }} /usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi
WSGIDaemonProcess horizon user=www-data group=www-data processes=3 threads=10
WSGIDaemonProcess horizon user=www-data group=www-data processes={{ processes }} threads=10
WSGIProcessGroup horizon
Alias /static /var/lib/openstack-dashboard/static/
Alias /horizon/static /var/lib/openstack-dashboard/static/

View File

@ -1,5 +1,5 @@
WSGIScriptAlias {{ webroot }} /usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi
WSGIDaemonProcess horizon user=horizon group=horizon processes=3 threads=10
WSGIDaemonProcess horizon user=horizon group=horizon processes={{ processes }} threads=10
WSGIProcessGroup horizon
Alias /static /var/lib/openstack-dashboard/static/
Alias /horizon/static /var/lib/openstack-dashboard/static/