Skip to content

Commit

Permalink
Set Neutron workers according CPU count
Browse files Browse the repository at this point in the history
In order to improve scalability of neutron-server and
neutron-metadata-agent we need to spawn multiple processes. This patch
changes default of api, rpc and metadata workers according to processors
count on physical machine.

Change-Id: I0480f1652b181e50a8c10230c293d6dfdec3a670
  • Loading branch information
cubeek committed Sep 12, 2014
1 parent 67cc3a8 commit 3445712
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 19 deletions.
7 changes: 4 additions & 3 deletions manifests/agents/metadata.pp
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@
#
# [*metadata_workers*]
# (optional) Number of separate worker processes to spawn.
# The default, 0, runs the worker thread in the current process.
# 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: 0
# Defaults to: $::processorcount
#
# [*metadata_backlog*]
# (optional) Number of backlog requests to configure the metadata server socket with.
Expand All @@ -75,7 +76,7 @@
$auth_region = 'RegionOne',
$metadata_ip = '127.0.0.1',
$metadata_port = '8775',
$metadata_workers = '0',
$metadata_workers = $::processorcount,
$metadata_backlog = '4096'
) {

Expand Down
14 changes: 8 additions & 6 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,19 @@
#
# [*api_workers*]
# (optional) Number of separate worker processes to spawn.
# The default, 0, runs the worker thread in the current process.
# 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: 0
# Defaults to: $::processorcount
#
# [*rpc_workers*]
# (optional) Number of separate RPC worker processes to spawn.
# The default, 0, runs the worker thread in the current process.
# 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: 0
# Defaults to: $::processorcount
#
# [*agent_down_time*]
# (optional) Seconds to regard the agent as down; should be at least twice
Expand Down Expand Up @@ -157,8 +159,8 @@
$database_idle_timeout = 3600,
$database_retry_interval = 10,
$sync_db = false,
$api_workers = '0',
$rpc_workers = '0',
$api_workers = $::processorcount,
$rpc_workers = $::processorcount,
$agent_down_time = '75',
$router_scheduler_driver = 'neutron.scheduler.l3_agent_scheduler.ChanceScheduler',
# DEPRECATED PARAMETERS
Expand Down
9 changes: 5 additions & 4 deletions spec/classes/neutron_agents_metadata_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
:auth_password => 'password',
:metadata_ip => '127.0.0.1',
:metadata_port => '8775',
:metadata_workers => '2',
:metadata_backlog => '4096',
:shared_secret => 'metadata-secret'
}
Expand Down Expand Up @@ -58,7 +57,7 @@
should contain_neutron_metadata_agent_config('DEFAULT/admin_password').with_secret( true )
should contain_neutron_metadata_agent_config('DEFAULT/nova_metadata_ip').with(:value => params[:metadata_ip])
should contain_neutron_metadata_agent_config('DEFAULT/nova_metadata_port').with(:value => params[:metadata_port])
should contain_neutron_metadata_agent_config('DEFAULT/metadata_workers').with(:value => params[:metadata_workers])
should contain_neutron_metadata_agent_config('DEFAULT/metadata_workers').with(:value => facts[:processorcount])
should contain_neutron_metadata_agent_config('DEFAULT/metadata_backlog').with(:value => params[:metadata_backlog])
should contain_neutron_metadata_agent_config('DEFAULT/metadata_proxy_shared_secret').with(:value => params[:shared_secret])
end
Expand All @@ -81,7 +80,8 @@

context 'on Debian platforms' do
let :facts do
{ :osfamily => 'Debian' }
{ :osfamily => 'Debian',
:processorcount => '2' }
end

let :platform_params do
Expand All @@ -103,7 +103,8 @@

context 'on Red Hat platforms' do
let :facts do
{ :osfamily => 'RedHat' }
{ :osfamily => 'RedHat',
:processorcount => '2' }
end

let :platform_params do
Expand Down
12 changes: 6 additions & 6 deletions spec/classes/neutron_server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
:database_idle_timeout => '3600',
:database_retry_interval => '10',
:sync_db => false,
:api_workers => '0',
:rpc_workers => '0',
:agent_down_time => '75',
:router_scheduler_driver => 'neutron.scheduler.l3_agent_scheduler.ChanceScheduler',
}
Expand Down Expand Up @@ -82,8 +80,8 @@
should contain_neutron_api_config('filter:authtoken/auth_admin_prefix').with(
:ensure => 'absent'
)
should contain_neutron_config('DEFAULT/api_workers').with_value(p[:api_workers])
should contain_neutron_config('DEFAULT/rpc_workers').with_value(p[:rpc_workers])
should contain_neutron_config('DEFAULT/api_workers').with_value(facts[:processorcount])
should contain_neutron_config('DEFAULT/rpc_workers').with_value(facts[:processorcount])
should contain_neutron_config('DEFAULT/agent_down_time').with_value(p[:agent_down_time])
should contain_neutron_config('DEFAULT/router_scheduler_driver').with_value(p[:router_scheduler_driver])
end
Expand Down Expand Up @@ -240,7 +238,8 @@

context 'on Debian platforms' do
let :facts do
{ :osfamily => 'Debian' }
{ :osfamily => 'Debian',
:processorcount => '2' }
end

let :platform_params do
Expand All @@ -261,7 +260,8 @@

context 'on RedHat platforms' do
let :facts do
{ :osfamily => 'RedHat' }
{ :osfamily => 'RedHat',
:processorcount => '2' }
end

let :platform_params do
Expand Down

0 comments on commit 3445712

Please sign in to comment.