From 93045f31241997d6fddc466d854626b030e72336 Mon Sep 17 00:00:00 2001 From: Narinder Gupta Date: Thu, 11 Aug 2016 12:10:03 -0500 Subject: [PATCH] modified the heat charm to accomodate the workers-mutiplier option Heat charm was missing this functionality and this patch is to add this feature. We were trying to deploy this charm in a lxc container on a host machine with 72 cores. In end up creating 144 process with heat-engine and heat-api. This patch will provide the option to limit the number of worker process in case of high number of cores in a host. Enable it for icehouse, kilo, liberty and mitaka. Change-Id: I811f0a91e1ff9a6d95e80a4a40be063d7d047c7e --- config.yaml | 7 +++++++ hooks/heat_utils.py | 1 + templates/icehouse/heat.conf | 3 +++ templates/kilo/heat.conf | 3 +++ templates/liberty/heat.conf | 3 +++ templates/mitaka/heat.conf | 3 +++ 6 files changed, 20 insertions(+) diff --git a/config.yaml b/config.yaml index 3ee4f74..d7f16c2 100644 --- a/config.yaml +++ b/config.yaml @@ -217,4 +217,11 @@ options: description: | Apply system hardening. Supports a space-delimited list of modules to run. Supported modules currently include os, ssh, apache and mysql. + worker-multiplier: + type: float + default: 2.0 + description: | + The CPU core multiplier to use when configuring worker processes for + Heat. By default, the number of workers for each daemon is set to + twice the number of CPU cores a service unit has. diff --git a/hooks/heat_utils.py b/hooks/heat_utils.py index 09d18f7..ff2d01f 100644 --- a/hooks/heat_utils.py +++ b/hooks/heat_utils.py @@ -101,6 +101,7 @@ CONFIG_FILES = OrderedDict([ InstanceUserContext(), context.SyslogContext(), context.LogLevelContext(), + context.WorkerConfigContext(), context.BindHostContext()] }), (HEAT_API_PASTE, { diff --git a/templates/icehouse/heat.conf b/templates/icehouse/heat.conf index 19b4fad..0aa1047 100644 --- a/templates/icehouse/heat.conf +++ b/templates/icehouse/heat.conf @@ -12,6 +12,7 @@ environment_dir=/etc/heat/environment.d deferred_auth_method=password host=heat auth_encryption_key={{ encryption_key }} +num_engine_workers = {{ workers }} {% if database_host -%} # < Icehouse db config @@ -70,6 +71,7 @@ bind_port={{ api_listen_port }} {% else -%} bind_port=8004 {% endif %} +workers = {{ workers }} [heat_api_cfn] {% if api_cfn_listen_port -%} @@ -77,3 +79,4 @@ bind_port={{ api_cfn_listen_port }} {% else -%} bind_port=8000 {% endif %} +workers = {{ workers }} diff --git a/templates/kilo/heat.conf b/templates/kilo/heat.conf index ecc3c9d..4d4b9eb 100644 --- a/templates/kilo/heat.conf +++ b/templates/kilo/heat.conf @@ -13,6 +13,7 @@ deferred_auth_method = trusts stack_domain_admin = heat_domain_admin stack_domain_admin_password = {{ heat_domain_admin_passwd }} stack_user_domain_name = heat +num_engine_workers = {{ workers }} {% if auth_host -%} [keystone_authtoken] @@ -43,6 +44,7 @@ bind_port={{ api_listen_port }} {% else -%} bind_port=8004 {% endif %} +workers = {{ workers }} [heat_api_cfn] bind_host = {{ bind_host }} @@ -51,6 +53,7 @@ bind_port={{ api_cfn_listen_port }} {% else -%} bind_port=8000 {% endif %} +workers = {{ workers }} {% include "section-rabbitmq-oslo" %} diff --git a/templates/liberty/heat.conf b/templates/liberty/heat.conf index 645747b..38f3091 100644 --- a/templates/liberty/heat.conf +++ b/templates/liberty/heat.conf @@ -13,6 +13,7 @@ deferred_auth_method = trusts stack_domain_admin = heat_domain_admin stack_domain_admin_password = {{ heat_domain_admin_passwd }} stack_user_domain_name = heat +num_engine_workers = {{ workers }} {% if auth_host -%} [keystone_authtoken] @@ -56,6 +57,7 @@ bind_port={{ api_listen_port }} {% else -%} bind_port=8004 {% endif %} +workers = {{ workers }} [heat_api_cfn] bind_host = {{ bind_host }} @@ -64,6 +66,7 @@ bind_port={{ api_cfn_listen_port }} {% else -%} bind_port=8000 {% endif %} +workers = {{ workers }} {% include "section-rabbitmq-oslo" %} diff --git a/templates/mitaka/heat.conf b/templates/mitaka/heat.conf index dbe93fa..54411e7 100644 --- a/templates/mitaka/heat.conf +++ b/templates/mitaka/heat.conf @@ -13,6 +13,7 @@ deferred_auth_method = trusts stack_domain_admin = heat_domain_admin stack_domain_admin_password = {{ heat_domain_admin_passwd }} stack_user_domain_name = heat +num_engine_workers = {{ workers }} {% if auth_host -%} {% include "section-keystone-authtoken-mitaka" %} @@ -47,6 +48,7 @@ bind_port={{ api_listen_port }} {% else -%} bind_port=8004 {% endif %} +workers = {{ workers }} [heat_api_cfn] bind_host = {{ bind_host }} @@ -55,6 +57,7 @@ bind_port={{ api_cfn_listen_port }} {% else -%} bind_port=8000 {% endif %} +workers = {{ workers }} {% include "section-rabbitmq-oslo" %}