diff --git a/defaults/main.yml b/defaults/main.yml index 5a7bc30e..196287a5 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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 diff --git a/releasenotes/notes/capping_neutron_workers-d97a5d50ca996af5.yaml b/releasenotes/notes/capping_neutron_workers-d97a5d50ca996af5.yaml new file mode 100644 index 00000000..9517de6d --- /dev/null +++ b/releasenotes/notes/capping_neutron_workers-d97a5d50ca996af5.yaml @@ -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. diff --git a/templates/dhcp_agent.ini.j2 b/templates/dhcp_agent.ini.j2 index 1ca172b0..2845ba6d 100644 --- a/templates/dhcp_agent.ini.j2 +++ b/templates/dhcp_agent.ini.j2 @@ -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 }} diff --git a/templates/metadata_agent.ini.j2 b/templates/metadata_agent.ini.j2 index ebe6ac30..5ec7dfeb 100644 --- a/templates/metadata_agent.ini.j2 +++ b/templates/metadata_agent.ini.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 %} - # 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 diff --git a/templates/neutron.conf.j2 b/templates/neutron.conf.j2 index bf163769..8bdb09bd 100644 --- a/templates/neutron.conf.j2 +++ b/templates/neutron.conf.j2 @@ -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 %}