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.

Also removed the comment related to an unused variable
sahara_engine_workers in defaults/main.yml

Change-Id: Idc39c7fc2188332fbaeb771906c0b9a402d17646
This commit is contained in:
Ravi Gummadi 2017-03-02 12:32:09 -05:00
parent 4f641881a5
commit 29045b953f
3 changed files with 10 additions and 11 deletions

View File

@ -123,13 +123,9 @@ sahara_plugin_base:
sahara_plugin_loaded_base: "{% for plugin in sahara_plugin_base %}{{ plugin }}{% if not loop.last %},{% endif %}{% endfor %}"
# If ``sahara_api_workers`` is unset the system will use half the number of available VCPUS to
# compute the number of api workers to use.
# sahara_api_workers: 16
# If ``sahara_engine_workers`` is unset the system will use half the number of available VCPUS to
# compute the number of api workers to use.
# sahara_engine_workers: 16
## Cap the maximum number of threads / workers when a user value is unspecified.
sahara_api_workers_max: 16
sahara_api_workers: "{{ [[ansible_processor_vcpus|default(2) // 2, 1] | max, sahara_api_workers_max] | min }}"
sahara_task_executor: taskflow
sahara_digest_algorithm: sha256

View File

@ -0,0 +1,6 @@
---
features:
- Capping the default value for the variable ``sahara_api_workers``
to 16 when the user doesn't configure this variable. 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
@ -12,7 +9,7 @@ log_file = /var/log/sahara/sahara.log
fatal_deprecations = {{ sahara_fatal_deprecations }}
host = {{ sahara_api_bind_address }}
port = {{ sahara_api_service_port }}
workers = {{ sahara_api_workers | default(api_threads) }}
workers = {{ sahara_api_workers }}
use_floating_ips = {{ sahara_use_floating_ips }}
use_neutron = {{ sahara_use_neutron }}
use_namespaces = {{ sahara_use_namespaces }}