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: I10a653dda7444b756fede74ce434b9038415c74c
This commit is contained in:
Ravi Gummadi 2017-02-23 05:06:44 -05:00
parent f281a4844d
commit bf6e06e666
5 changed files with 14 additions and 16 deletions

View File

@ -441,15 +441,16 @@ neutron_quota_vip: 10
## General Neutron configuration
# If ``neutron_api_workers`` is unset the system will use half the number of available VCPUs to
# compute the number of api workers to use.
# compute the number of api workers to use with a default capping value of 16.
# neutron_api_workers: 16
# If ``neutron_metadata_workers`` is unset the system will use half the number of available VCPUs to
# compute the number of api workers to use.
# compute the number of api workers to use with a default capping value of 16.
# neutron_metadata_workers: 16
## Cap the maximun number of threads / workers when a user value is unspecified.
neutron_api_threads_max: 16
neutron_api_threads: "{{ [[ansible_processor_vcpus|default(2) // 2, 1] | max, neutron_api_threads_max] | min }}"
neutron_metadata_backlog: 4096
@ -534,8 +535,8 @@ neutron_dns_domain: openstacklocal
neutron_dnsmasq_dns_servers: ""
# Limit number of leases to prevent a denial-of-service.
neutron_dnsmasq_lease_max: 16777216
# If ``neutron_num_sync_threads`` is unset, the system will use the value of api_workers calculated
# in templates/dhcp_agent.ini.j2 for num_sync_threads.
# If ``neutron_num_sync_threads`` is unset, the system will use the value of
# neutron_api_threads in templates/dhcp_agent.ini.j2 for num_sync_threads.
# neutron_num_sync_threads: 4
## RPC

View File

@ -0,0 +1,6 @@
---
features:
- Capping the default value for the variables ``neutron_api_workers``,
``neutron_num_sync_threads`` and ``neutron_metadata_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,13 +1,10 @@
# {{ ansible_managed }}
{% set _api_threads = ansible_processor_vcpus|default(2) // 2 %}
{% set api_threads = _api_threads if _api_threads > 0 else 1 %}
# General
[DEFAULT]
debug = {{ debug }}
num_sync_threads = {{ neutron_num_sync_threads | default(api_threads) }}
num_sync_threads = {{ neutron_num_sync_threads | default(neutron_api_threads) }}
# Drivers
interface_driver = {{ neutron_plugins[neutron_plugin_type].driver_interface }}

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 %}
# General
[DEFAULT]
debug = {{ debug }}
@ -27,7 +24,7 @@ nova_metadata_port = {{ nova_metadata_port }}
metadata_proxy_shared_secret = {{ nova_metadata_proxy_secret }}
# Workers and backlog requests
metadata_workers = {{ neutron_metadata_workers | default(api_threads) }}
metadata_workers = {{ neutron_metadata_workers | default(neutron_api_threads) }}
metadata_backlog = {{ neutron_metadata_backlog }}
# Caching

View File

@ -1,8 +1,5 @@
# {{ ansible_managed }}
{% set _api_threads = [ansible_processor_vcpus|default(2) // 2, neutron_api_threads_max] | min %}
{% set api_threads = _api_threads if _api_threads > 0 else 1 %}
# General, applies to all host groups
[DEFAULT]
# Disable stderr logging
@ -78,7 +75,7 @@ bind_port = 9696
bind_host = 0.0.0.0
# Workers
api_workers = {{ neutron_api_workers | default(api_threads) }}
api_workers = {{ neutron_api_workers | default(neutron_api_threads) }}
rpc_workers = {{ neutron_rpc_workers }}
{% set dhcp_agents_max = num_agent if num_agent > 2 else 2 %}