Cap the number of worker threads

Users can configure the number of worker threads however when it's
not specified the calculated number of workers can get too large on
hosts with a large number of CPUs.

Change-Id: Ie4fae6e015a58399cb8656e88d6b9aa514ecaa5d
(cherry picked from commit 3d16c31779)
This commit is contained in:
Ravi Gummadi 2017-02-23 01:11:00 -05:00 committed by Jesse Pretorius (odyssey4me)
parent 978f7b18f9
commit 7d89c47f83
3 changed files with 12 additions and 5 deletions

View File

@ -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

View File

@ -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.

View File

@ -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 }}