diff --git a/defaults/main.yml b/defaults/main.yml index 155b3fa..054a890 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -165,6 +165,10 @@ heat_watch_server_url: "{{ heat_watch_server_uri }}" # heat_engine_workers: 4 # heat_api_workers: 4 +## Cap the maximum number of threads / workers when a user value is unspecified. +heat_api_threads_max: 16 +heat_api_threads: "{{ [[ansible_processor_vcpus|default(2) // 2, 1] | max, heat_api_threads_max] | min }}" + heat_service_in_ldap: false ## Plugin dirs diff --git a/releasenotes/notes/capping_heat_workers-13791c456e59277d.yaml b/releasenotes/notes/capping_heat_workers-13791c456e59277d.yaml new file mode 100644 index 0000000..eae7447 --- /dev/null +++ b/releasenotes/notes/capping_heat_workers-13791c456e59277d.yaml @@ -0,0 +1,6 @@ +--- +features: + - Capping the default value for the variables + ``heat_api_workers`` and ``heat_engine_workers`` to 16 when the user + doesn't configure these variables. Default value is half the number of + vCPUs available on the machine with a capping value of 16. diff --git a/templates/heat.conf.j2 b/templates/heat.conf.j2 index b4a0d78..d5316e6 100644 --- a/templates/heat.conf.j2 +++ b/templates/heat.conf.j2 @@ -1,8 +1,5 @@ # {{ ansible_managed }} -{% set _api_threads = ansible_processor_vcpus|default(2) // 2 %} -{% set api_threads = _api_threads if _api_threads > 0 else 1 %} - [DEFAULT] # Disable stderr logging use_stderr = False @@ -24,7 +21,7 @@ trusts_delegated_roles = {{ heat_trusts_delegated_roles | join(',') }} auth_encryption_key = {{ heat_auth_encryption_key }} -num_engine_workers = {{ heat_engine_workers | default(api_threads) }} +num_engine_workers = {{ heat_engine_workers | default(heat_api_threads) }} ## RPC Backend rpc_backend = {{ heat_rpc_backend }} @@ -55,7 +52,7 @@ auth_uri = {{ keystone_service_internalurl }} [heat_api] bind_port = {{ heat_service_port }} -workers = {{ heat_api_workers | default(api_threads) }} +workers = {{ heat_api_workers | default(heat_api_threads) }} [heat_api_cfn] bind_port = {{ heat_cfn_service_port }}