Change worker defaults to ::os_workers

This patch changes the default worker count from ::processorcount to the
new ::os_workers fact. ::os_workers is based on the number of processors
(currently cpu/4) but is capped at a maximum of 8 worker processors.
This is a much more reasonable default in general and prevents excessive
resource consumption on systems with a large number of CPUs.

Change-Id: Ic90461e7d843edf07d884d6717a2dd3e68664b24
This commit is contained in:
Brent Eagles 2016-09-30 10:03:06 -02:30
parent 9e7ed558f2
commit 08a93489e3
5 changed files with 24 additions and 28 deletions

View File

@ -39,12 +39,10 @@
# The protocol to use for requests to Nova metadata server. Defaults to $::os_service_default.
#
# [*metadata_workers*]
# (optional) Number of separate worker processes to spawn.
# The default, count of machine's processors, runs the worker thread in the
# current process.
# Greater than 0 launches that number of child processes as workers.
# The parent process manages them. Having more workers will help to improve performances.
# Defaults to: $::processorcount
# (optional) Number of separate worker processes to spawn. Greater than 0
# launches that number of child processes as workers. The parent process
# manages them.
# Defaults to: $::os_workers
#
# [*metadata_backlog*]
# (optional) Number of backlog requests to configure the metadata server socket with.
@ -72,7 +70,7 @@ class neutron::agents::metadata (
$metadata_ip = $::os_service_default,
$metadata_port = $::os_service_default,
$metadata_protocol = $::os_service_default,
$metadata_workers = $::processorcount,
$metadata_workers = $::os_workers,
$metadata_backlog = $::os_service_default,
$metadata_memory_cache_ttl = $::os_service_default,
$nova_client_cert = $::os_service_default,

View File

@ -65,20 +65,16 @@
# Defaults to false
#
# [*api_workers*]
# (optional) Number of separate worker processes to spawn.
# The default, count of machine's processors, runs the worker thread in the
# current process.
# Greater than 0 launches that number of child processes as workers.
# The parent process manages them.
# Defaults to: $::processorcount
# (optional) Number of separate worker processes to spawn. Greater than 0
# launches that number of child processes as workers. The parent process
# manages them.
# Defaults to: $::os_workers
#
# [*rpc_workers*]
# (optional) Number of separate RPC worker processes to spawn.
# The default, count of machine's processors, runs the worker thread in the
# current process.
# Greater than 0 launches that number of child processes as workers.
# The parent process manages them.
# Defaults to: $::processorcount
# (optional) Number of separate worker processes to spawn. Greater than 0
# launches that number of child processes as workers. The parent process
# manages them.
# Defaults to: $::os_workers
#
# [*agent_down_time*]
# (optional) Seconds to regard the agent as down; should be at least twice
@ -289,8 +285,8 @@ class neutron::server (
$database_max_pool_size = undef,
$database_max_overflow = undef,
$sync_db = false,
$api_workers = $::processorcount,
$rpc_workers = $::processorcount,
$api_workers = $::os_workers,
$rpc_workers = $::os_workers,
$agent_down_time = $::os_service_default,
$router_scheduler_driver = 'neutron.scheduler.l3_agent_scheduler.ChanceScheduler',
$router_distributed = $::os_service_default,

View File

@ -0,0 +1,5 @@
---
other:
- Parameters that control the number of spawned child processes for
distributing processing have had their default value changed from
::processorcount to ::os_workers.

View File

@ -18,7 +18,6 @@ describe 'neutron::agents::metadata' do
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default',
:processorcount => '2'
}
end
@ -60,7 +59,7 @@ describe 'neutron::agents::metadata' do
is_expected.to contain_neutron_metadata_agent_config('DEFAULT/nova_metadata_ip').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_neutron_metadata_agent_config('DEFAULT/nova_metadata_port').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_neutron_metadata_agent_config('DEFAULT/nova_metadata_protocol').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_neutron_metadata_agent_config('DEFAULT/metadata_workers').with(:value => facts[:processorcount])
is_expected.to contain_neutron_metadata_agent_config('DEFAULT/metadata_workers').with(:value => facts[:os_workers])
is_expected.to contain_neutron_metadata_agent_config('DEFAULT/metadata_backlog').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_neutron_metadata_agent_config('DEFAULT/metadata_proxy_shared_secret').with(:value => params[:shared_secret])
is_expected.to contain_neutron_metadata_agent_config('DEFAULT/cache_url').with(:ensure => 'absent')

View File

@ -74,8 +74,8 @@ describe 'neutron::server' do
is_expected.to contain_service('neutron-server').that_notifies('Anchor[neutron::service::end]')
is_expected.not_to contain_class('neutron::db::sync')
is_expected.to contain_service('neutron-server').with_name('neutron-server')
is_expected.to contain_neutron_config('DEFAULT/api_workers').with_value(facts[:processorcount])
is_expected.to contain_neutron_config('DEFAULT/rpc_workers').with_value(facts[:processorcount])
is_expected.to contain_neutron_config('DEFAULT/api_workers').with_value(facts[:os_workers])
is_expected.to contain_neutron_config('DEFAULT/rpc_workers').with_value(facts[:os_workers])
is_expected.to contain_neutron_config('DEFAULT/agent_down_time').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('DEFAULT/router_scheduler_driver').with_value(p[:router_scheduler_driver])
is_expected.to contain_neutron_config('qos/notification_drivers').with_value('<SERVICE DEFAULT>')
@ -256,7 +256,6 @@ describe 'neutron::server' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'Debian',
:processorcount => '2'
}))
end
@ -275,7 +274,6 @@ describe 'neutron::server' do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7',
:processorcount => '2'
}))
end