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: I6c950cc31b66479dc980ecd5eb580d403dd27ae6
This commit is contained in:
Ravi Gummadi 2017-02-23 05:45:47 -05:00
parent 5c99b10178
commit f83296e073
3 changed files with 14 additions and 7 deletions

View File

@ -276,7 +276,9 @@ nova_placement_nginx_extra_conf:
- keepalive_timeout 70;
nova_placement_uwsgi_socket_port: 8781
nova_wsgi_threads: 1
nova_wsgi_processes: "{{ (ansible_processor_vcpus | int > 0) | ternary (ansible_processor_vcpus, 1) * 2}}"
## Cap the maximum number of processes when a user value is unspecified.
nova_wsgi_processes_max: 16
nova_wsgi_processes: "{{ [[ansible_processor_vcpus|default(1), 1] | max * 2, nova_wsgi_processes_max] | min }}"
nova_wsgi_buffer_size: 65535
## Nova libvirt
@ -398,6 +400,7 @@ nova_ceph_client_uuid: 517a4663-3927-44bc-9ea7-4a90e1cd4c66
## Cap the maximun number of threads / workers when a user value is unspecified.
nova_api_threads_max: 16
nova_api_threads: "{{ [[ansible_processor_vcpus|default(2) // 2, 1] | max, nova_api_threads_max] | min }}"
## Policy vars
# Provide a list of access controls to update the default policy.json with. These changes will be merged

View File

@ -0,0 +1,7 @@
---
features:
- Capping the default value for the variables ``nova_wsgi_processes``,
``nova_osapi_compute_workers``, ``nova_metadata_workers`` and
``nova_conductor_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, nova_api_threads_max] | min %}
{% set api_threads = _api_threads if _api_threads > 0 else 1 %}
[DEFAULT]
# Disable stderr logging
use_stderr = False
@ -39,7 +36,7 @@ key = {{ nova_console_ssl_key }}
# Api's
enabled_apis = {{ nova_enabled_apis }}
osapi_compute_workers = {{ nova_osapi_compute_workers | default(api_threads) }}
osapi_compute_workers = {{ nova_osapi_compute_workers | default(nova_api_threads) }}
# Rpc all
transport_url = rabbit://{% for host in nova_rabbitmq_servers.split(',') %}{{ nova_rabbitmq_userid }}:{{ nova_rabbitmq_password }}@{{ host }}:{{ nova_rabbitmq_port }}{% if not loop.last %},{% else %}/{{ nova_rabbitmq_vhost }}{% endif %}{% endfor %}
@ -50,7 +47,7 @@ rpc_response_timeout = {{ nova_rpc_response_timeout }}
# Metadata
metadata_host = {{ nova_metadata_host }}
metadata_port = {{ nova_metadata_port }}
metadata_workers = {{ nova_metadata_workers | default(api_threads) }}
metadata_workers = {{ nova_metadata_workers | default(nova_api_threads) }}
# Network
dhcp_domain = {{ nova_dhcp_domain }}
@ -190,7 +187,7 @@ insecure = {{ keystone_service_adminuri_insecure | bool }}
{% endif %}
[conductor]
workers = {{ nova_conductor_workers | default(api_threads) }}
workers = {{ nova_conductor_workers | default(nova_api_threads) }}
[keystone_authtoken]