From 58205d76043e5ffbaf7475945b364448705f7bfa Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Wed, 25 Nov 2015 19:54:34 +0000 Subject: [PATCH] Implement tunable Horizon/Apache processes/threads overrides This patch introduces an override for the number of Apache processes and threads for Horizon: - horizon_wsgi_processes - horizon_wsgi_threads The values may be set in /etc/openstack_deploy/user_variables.yml and if they are unset, half the number of available vCPU's will be used instead. Implements: blueprint gate-split Change-Id: Ie608ef66b8979a466e72c6085c9afa6ab95cc6ff --- playbooks/roles/os_horizon/defaults/main.yml | 3 +++ .../roles/os_horizon/templates/openstack_dashboard.conf.j2 | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/playbooks/roles/os_horizon/defaults/main.yml b/playbooks/roles/os_horizon/defaults/main.yml index 71467de723..7885f0c4b7 100644 --- a/playbooks/roles/os_horizon/defaults/main.yml +++ b/playbooks/roles/os_horizon/defaults/main.yml @@ -75,6 +75,9 @@ horizon_enable_password_retrieve: False horizon_can_set_password: False horizon_enable_cinder_backup: False +# If the following variables are unset in user_variables, the value set will be half the number of available VCPUs +# horizon_wsgi_processes: 4 +# horizon_wsgi_threads: 4 ## Horizon SSL horizon_ssl_cert: /etc/ssl/certs/horizon.pem diff --git a/playbooks/roles/os_horizon/templates/openstack_dashboard.conf.j2 b/playbooks/roles/os_horizon/templates/openstack_dashboard.conf.j2 index ed77df24eb..3b71b6434d 100644 --- a/playbooks/roles/os_horizon/templates/openstack_dashboard.conf.j2 +++ b/playbooks/roles/os_horizon/templates/openstack_dashboard.conf.j2 @@ -1,6 +1,7 @@ # {{ ansible_managed }} -{% set threads = ansible_processor_vcpus // 2 %} +{% set _wsgi_threads = ansible_processor_vcpus | default(2) // 2 %} +{% set wsgi_threads = _wsgi_threads if _wsgi_threads > 0 else 1 %} ServerName {{ horizon_server_name }} @@ -30,7 +31,7 @@ SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown WSGIScriptAlias / {{ horizon_lib_wsgi_file }} - WSGIDaemonProcess horizon user={{ horizon_system_user_name }} group={{ horizon_system_group_name }} processes={{ ansible_processor_cores }} threads={{ threads if threads > 0 else 1 }} + WSGIDaemonProcess horizon user={{ horizon_system_user_name }} group={{ horizon_system_group_name }} processes={{ horizon_wsgi_processes | default(wsgi_threads) }} threads={{ horizon_wsgi_threads | default(wsgi_threads) }} WSGIProcessGroup horizon WSGIApplicationGroup horizon