Rework processorcount limits to os_workers

* reduce workers_max default limits of a 16 to the $::os_workers, which is limited by [2, 8] interval.
* reduce workers/pool size/overflow limited by F($::processorcount) to F($::os_workers)

Closes-bug: 1629238

Change-Id: I5cc4d70b902eeaa1c9cf42911606eba13dd84aa2
Signed-off-by: Bogdan Dobrelya <bdobrelia@mirantis.com>
This commit is contained in:
Bogdan Dobrelya 2016-09-30 12:03:34 +02:00
parent 1041899d2a
commit 1daccc4e9b
24 changed files with 45 additions and 38 deletions

View File

@ -5,6 +5,7 @@ describe "fuel::keystone" do
let :global_facts do let :global_facts do
{ {
:processorcount => 42, :processorcount => 42,
:os_workers => 8,
} }
end end

View File

@ -43,7 +43,7 @@ class openstack::cinder(
$keystone_user = 'cinder', $keystone_user = 'cinder',
$region = 'RegionOne', $region = 'RegionOne',
$notification_driver = undef, $notification_driver = undef,
$service_workers = $::processorcount, $service_workers = $::os_workers,
$vmware_host_ip = '10.10.10.10', $vmware_host_ip = '10.10.10.10',
$vmware_host_username = 'administrator@vsphere.local', $vmware_host_username = 'administrator@vsphere.local',
$vmware_host_password = 'password', $vmware_host_password = 'password',

View File

@ -35,7 +35,7 @@ class openstack_tasks::ceilometer::controller {
$service_endpoint = hiera('service_endpoint', $management_vip) $service_endpoint = hiera('service_endpoint', $management_vip)
$ha_mode = pick($ceilometer_hash['ha_mode'], true) $ha_mode = pick($ceilometer_hash['ha_mode'], true)
$ssl_hash = hiera_hash('use_ssl', {}) $ssl_hash = hiera_hash('use_ssl', {})
$workers_max = hiera('workers_max', 16) $workers_max = hiera('workers_max', $::os_workers)
$service_workers = pick($ceilometer_hash['workers'], $service_workers = pick($ceilometer_hash['workers'],
min(max($::processorcount, 2), $workers_max)) min(max($::processorcount, 2), $workers_max))

View File

@ -21,7 +21,7 @@ class openstack_tasks::glance::glance {
$max_overflow = hiera('max_overflow') $max_overflow = hiera('max_overflow')
$ceilometer_hash = hiera_hash('ceilometer', {}) $ceilometer_hash = hiera_hash('ceilometer', {})
$region = hiera('region','RegionOne') $region = hiera('region','RegionOne')
$workers_max = hiera('workers_max', 16) $workers_max = hiera('workers_max', $::os_workers)
$service_workers = pick($glance_hash['glance_workers'], $service_workers = pick($glance_hash['glance_workers'],
min(max($::processorcount, 2), $workers_max)) min(max($::processorcount, 2), $workers_max))
$ironic_hash = hiera_hash('ironic', {}) $ironic_hash = hiera_hash('ironic', {})

View File

@ -135,7 +135,7 @@ class openstack_tasks::horizon::horizon {
$wsgi_processes = 2 $wsgi_processes = 2
$wsgi_threads = 9 $wsgi_threads = 9
} else { } else {
$wsgi_processes = $::processorcount $wsgi_processes = $::os_workers
$wsgi_threads = 15 $wsgi_threads = 15
} }

View File

@ -34,8 +34,8 @@ class openstack_tasks::ironic::ironic_compute {
$db_name = pick($nova_hash['db_name'], 'nova') $db_name = pick($nova_hash['db_name'], 'nova')
$db_password = pick($nova_hash['db_password'], 'nova') $db_password = pick($nova_hash['db_password'], 'nova')
$max_pool_size = hiera('max_pool_size', min($::processorcount * 5 + 0, 30 + 0)) $max_pool_size = hiera('max_pool_size', min($::os_workers * 5 + 0, 30 + 0))
$max_overflow = hiera('max_overflow', min($::processorcount * 5 + 0, 60 + 0)) $max_overflow = hiera('max_overflow', min($::os_workers * 5 + 0, 60 + 0))
$idle_timeout = hiera('idle_timeout', '3600') $idle_timeout = hiera('idle_timeout', '3600')
$max_retries = hiera('max_retries', '-1') $max_retries = hiera('max_retries', '-1')

View File

@ -33,7 +33,7 @@ class openstack_tasks::keystone::keystone {
$syslog_log_facility = hiera('syslog_log_facility_keystone') $syslog_log_facility = hiera('syslog_log_facility_keystone')
$rabbit_hash = hiera_hash('rabbit', {}) $rabbit_hash = hiera_hash('rabbit', {})
$neutron_user_password = hiera('neutron_user_password', false) $neutron_user_password = hiera('neutron_user_password', false)
$workers_max = hiera('workers_max', 16) $workers_max = hiera('workers_max', $::os_workers)
$service_workers = pick($keystone_hash['workers'], $service_workers = pick($keystone_hash['workers'],
min(max($::processorcount, 2), $workers_max)) min(max($::processorcount, 2), $workers_max))
$default_log_levels = hiera_hash('default_log_levels') $default_log_levels = hiera_hash('default_log_levels')

View File

@ -13,7 +13,7 @@ class openstack_tasks::openstack_cinder::openstack_cinder {
$sahara_hash = hiera_hash('sahara', {}) $sahara_hash = hiera_hash('sahara', {})
$rabbit_hash = hiera_hash('rabbit', {}) $rabbit_hash = hiera_hash('rabbit', {})
$service_endpoint = hiera('service_endpoint') $service_endpoint = hiera('service_endpoint')
$workers_max = hiera('workers_max', 16) $workers_max = hiera('workers_max', $::os_workers)
$service_workers = pick($cinder_hash['workers'], min(max($::processorcount, 2), $workers_max)) $service_workers = pick($cinder_hash['workers'], min(max($::processorcount, 2), $workers_max))
$cinder_user_password = $cinder_hash[user_password] $cinder_user_password = $cinder_hash[user_password]
$keystone_user = pick($cinder_hash['user'], 'cinder') $keystone_user = pick($cinder_hash['user'], 'cinder')
@ -107,8 +107,8 @@ class openstack_tasks::openstack_cinder::openstack_cinder {
} }
# SQLAlchemy backend configuration # SQLAlchemy backend configuration
$max_pool_size = min($::processorcount * 5 + 0, 30 + 0) $max_pool_size = min($::os_workers * 5 + 0, 30 + 0)
$max_overflow = min($::processorcount * 5 + 0, 60 + 0) $max_overflow = min($::os_workers * 5 + 0, 60 + 0)
$max_retries = '-1' $max_retries = '-1'
$idle_timeout = '3600' $idle_timeout = '3600'

View File

@ -68,7 +68,7 @@ class openstack_tasks::openstack_controller::openstack_controller {
$keystone_user = pick($nova_hash['user'], 'nova') $keystone_user = pick($nova_hash['user'], 'nova')
$keystone_tenant = pick($nova_hash['tenant'], 'services') $keystone_tenant = pick($nova_hash['tenant'], 'services')
$region_name = hiera('region', 'RegionOne') $region_name = hiera('region', 'RegionOne')
$workers_max = hiera('workers_max', 16) $workers_max = hiera('workers_max', $::os_workers)
$service_workers = pick($nova_hash['workers'], $service_workers = pick($nova_hash['workers'],
min(max($::processorcount, 2), $workers_max)) min(max($::processorcount, 2), $workers_max))
$compute_nodes = get_nodes_hash_by_roles($network_metadata, ['compute']) $compute_nodes = get_nodes_hash_by_roles($network_metadata, ['compute'])
@ -137,8 +137,8 @@ class openstack_tasks::openstack_controller::openstack_controller {
}) })
# SQLAlchemy backend configuration # SQLAlchemy backend configuration
$max_pool_size = hiera('max_pool_size', min($::processorcount * 5 + 0, 30 + 0)) $max_pool_size = hiera('max_pool_size', min($::os_workers * 5 + 0, 30 + 0))
$max_overflow = hiera('max_overflow', min($::processorcount * 5 + 0, 60 + 0)) $max_overflow = hiera('max_overflow', min($::os_workers * 5 + 0, 60 + 0))
$idle_timeout = hiera('idle_timeout', '3600') $idle_timeout = hiera('idle_timeout', '3600')
$max_retries = hiera('max_retries', '-1') $max_retries = hiera('max_retries', '-1')

View File

@ -9,7 +9,7 @@ class openstack_tasks::openstack_network::agents::metadata {
$neutron_advanced_config = hiera_hash('neutron_advanced_configuration', { }) $neutron_advanced_config = hiera_hash('neutron_advanced_configuration', { })
$neutron_config = hiera_hash('neutron_config') $neutron_config = hiera_hash('neutron_config')
$dvr = pick($neutron_advanced_config['neutron_dvr'], false) $dvr = pick($neutron_advanced_config['neutron_dvr'], false)
$workers_max = hiera('workers_max', 16) $workers_max = hiera('workers_max', $::os_workers)
if $compute { if $compute {
$metadata_workers = pick($neutron_config['workers'], $metadata_workers = pick($neutron_config['workers'],

View File

@ -85,7 +85,7 @@ class openstack_tasks::openstack_network::server_config {
$auth_url = "${internal_auth_protocol}://${internal_auth_endpoint}:35357/" $auth_url = "${internal_auth_protocol}://${internal_auth_endpoint}:35357/"
$nova_admin_auth_url = "${admin_auth_protocol}://${admin_auth_endpoint}:35357/" $nova_admin_auth_url = "${admin_auth_protocol}://${admin_auth_endpoint}:35357/"
$workers_max = hiera('workers_max', 16) $workers_max = hiera('workers_max', $::os_workers)
$service_workers = pick($neutron_config['workers'], min(max($::processorcount, 1), $workers_max)) $service_workers = pick($neutron_config['workers'], min(max($::processorcount, 1), $workers_max))
$neutron_advanced_config = hiera_hash('neutron_advanced_configuration', { }) $neutron_advanced_config = hiera_hash('neutron_advanced_configuration', { })

View File

@ -80,8 +80,8 @@ class openstack_tasks::roles::cinder {
} }
# SQLAlchemy backend configuration # SQLAlchemy backend configuration
$max_pool_size = min($::processorcount * 5 + 0, 30 + 0) $max_pool_size = min($::os_workers * 5 + 0, 30 + 0)
$max_overflow = min($::processorcount * 5 + 0, 60 + 0) $max_overflow = min($::os_workers * 5 + 0, 60 + 0)
$max_retries = '-1' $max_retries = '-1'
$idle_timeout = '3600' $idle_timeout = '3600'

View File

@ -50,8 +50,8 @@ class openstack_tasks::sahara::sahara {
$sahara_user = pick($sahara_hash['user'], 'sahara') $sahara_user = pick($sahara_hash['user'], 'sahara')
$sahara_password = pick($sahara_hash['user_password']) $sahara_password = pick($sahara_hash['user_password'])
$tenant = pick($sahara_hash['tenant'], 'services') $tenant = pick($sahara_hash['tenant'], 'services')
$max_pool_size = min($::processorcount * 5 + 0, 30 + 0) $max_pool_size = min($::os_workers * 5 + 0, 30 + 0)
$max_overflow = min($::processorcount * 5 + 0, 60 + 0) $max_overflow = min($::os_workers * 5 + 0, 60 + 0)
$max_retries = '-1' $max_retries = '-1'
$idle_timeout = '3600' $idle_timeout = '3600'

View File

@ -26,7 +26,7 @@ class openstack_tasks::swift::parts::proxy (
'account_quotas', 'account_quotas',
'slo', 'slo',
'proxy-server'], 'proxy-server'],
$proxy_workers = $::processorcount, $proxy_workers = $::os_workers,
$proxy_port = '8080', $proxy_port = '8080',
$proxy_allow_account_management = true, $proxy_allow_account_management = true,
$proxy_account_autocreate = true, $proxy_account_autocreate = true,

View File

@ -31,7 +31,7 @@ class openstack_tasks::swift::proxy_storage {
$keystone_user = pick($swift_hash['user'], 'swift') $keystone_user = pick($swift_hash['user'], 'swift')
$keystone_password = pick($swift_hash['user_password'], 'passsword') $keystone_password = pick($swift_hash['user_password'], 'passsword')
$keystone_tenant = pick($swift_hash['tenant'], 'services') $keystone_tenant = pick($swift_hash['tenant'], 'services')
$workers_max = hiera('workers_max', 16) $workers_max = hiera('workers_max', $::os_workers)
$service_workers = pick($swift_hash['workers'], min(max($::processorcount, 2), $workers_max)) $service_workers = pick($swift_hash['workers'], min(max($::processorcount, 2), $workers_max))
$ssl_hash = hiera_hash('use_ssl', {}) $ssl_hash = hiera_hash('use_ssl', {})
$rabbit_hash = hiera_hash('rabbit') $rabbit_hash = hiera_hash('rabbit')

View File

@ -11,7 +11,7 @@ class osnailyfacter::apache_mpm inherits ::osnailyfacter::apache {
if ($::processorcount + 0) <= 2 { if ($::processorcount + 0) <= 2 {
$startservers = 2 $startservers = 2
} else { } else {
$startservers = $::processorcount $startservers = $::os_workers
} }
$maxrequestsperchild = 0 $maxrequestsperchild = 0

View File

@ -311,14 +311,14 @@ class osnailyfacter::globals::globals {
# The default value assumes there are 20 different types of workers limited by 100Mb each. # The default value assumes there are 20 different types of workers limited by 100Mb each.
$workers_ratio = hiera('workers_ratio', 2000) $workers_ratio = hiera('workers_ratio', 2000)
# Defines the maximum allowed number of workers for each service by RAM limits. Cannot exceed the value of 30. # Defines the maximum allowed number of workers for each service by RAM limits. Cannot exceed the value of 30.
$workers_max = inline_template("<%= [(@memorysize_mb.to_i / @workers_ratio.to_i).floor + 1, 30].min %>") $workers_max = inline_template("<%= [(@memorysize_mb.to_i / @workers_ratio.to_i).floor + 1, $::os_workers].min %>")
$node_name_prefix_for_messaging = hiera('node_name_prefix_for_messaging', 'messaging-') $node_name_prefix_for_messaging = hiera('node_name_prefix_for_messaging', 'messaging-')
# MySQL and SQLAlchemy backend configuration # MySQL and SQLAlchemy backend configuration
$custom_mysql_setup_class = hiera('custom_mysql_setup_class', 'galera') $custom_mysql_setup_class = hiera('custom_mysql_setup_class', 'galera')
$max_pool_size = hiera('max_pool_size', min($::processorcount * 5 + 0, 30 + 0)) $max_pool_size = hiera('max_pool_size', min($::os_workers * 5 + 0, 30 + 0))
$max_overflow = hiera('max_overflow', min($::processorcount * 5 + 0, 60 + 0)) $max_overflow = hiera('max_overflow', min($::os_workers * 5 + 0, 60 + 0))
$max_retries = hiera('max_retries', '-1') $max_retries = hiera('max_retries', '-1')
$idle_timeout = hiera('idle_timeout','3600') $idle_timeout = hiera('idle_timeout','3600')
$nova_db_password = $nova_hash['db_password'] $nova_db_password = $nova_hash['db_password']

View File

@ -73,6 +73,7 @@ describe 'osnailyfacter::atop' do
:osfamily => 'Debian', :osfamily => 'Debian',
:operatingsystem => 'Debian', :operatingsystem => 'Debian',
:processorcount => 2, :processorcount => 2,
:os_workers => 2,
:memorysize_mb => 4096, :memorysize_mb => 4096,
} }
end end
@ -86,6 +87,7 @@ describe 'osnailyfacter::atop' do
:osfamily => 'RedHat', :osfamily => 'RedHat',
:operatingsystem => 'RedHat', :operatingsystem => 'RedHat',
:processorcount => 2, :processorcount => 2,
:os_workers => 2,
:memorysize_mb => 4096, :memorysize_mb => 4096,
} }
end end

View File

@ -100,11 +100,11 @@ describe manifest do
else else
extra_params = '?charset=utf8' extra_params = '?charset=utf8'
end end
facts[:processorcount] = 10 facts[:os_workers] = 8
max_overflow = Noop.hiera 'max_overflow', [facts[:processorcount] * 5 + 0, 60 + 0].min max_overflow = Noop.hiera 'max_overflow', [facts[:os_workers] * 5 + 0, 60 + 0].min
idle_timeout = Noop.hiera 'idle_timeout', '3600' idle_timeout = Noop.hiera 'idle_timeout', '3600'
max_retries = Noop.hiera 'max_retries', '-1' max_retries = Noop.hiera 'max_retries', '-1'
max_pool_size = Noop.hiera 'max_pool_size', [facts[:processorcount] * 5 + 0, 30 + 0].min max_pool_size = Noop.hiera 'max_pool_size', [facts[:os_workers] * 5 + 0, 30 + 0].min
should contain_class('nova').with( should contain_class('nova').with(
:database_connection => "mysql://#{nova_db_user}:#{nova_db_password}@#{database_vip}/#{nova_db_name}#{extra_params}", :database_connection => "mysql://#{nova_db_user}:#{nova_db_password}@#{database_vip}/#{nova_db_name}#{extra_params}",

View File

@ -223,6 +223,7 @@ describe manifest do
it 'should declare keystone::wsgi::apache class with 6 processes and 1 threads on 48 CPU system' do it 'should declare keystone::wsgi::apache class with 6 processes and 1 threads on 48 CPU system' do
facts[:processorcount] = 48 facts[:processorcount] = 48
facts[:os_workers] = 8
should contain_class('keystone::wsgi::apache').with( should contain_class('keystone::wsgi::apache').with(
'threads' => '1', 'threads' => '1',
'workers' => '6' 'workers' => '6'
@ -231,6 +232,7 @@ describe manifest do
it 'should declare keystone::wsgi::apache class with 1 process and 1 threads on 1 CPU system' do it 'should declare keystone::wsgi::apache class with 1 process and 1 threads on 1 CPU system' do
facts[:processorcount] = 1 facts[:processorcount] = 1
facts[:os_workers] = 2
should contain_class('keystone::wsgi::apache').with( should contain_class('keystone::wsgi::apache').with(
'threads' => '1', 'threads' => '1',
'workers' => '1' 'workers' => '1'

View File

@ -178,9 +178,9 @@ describe manifest do
end end
it 'should configure nova with the basics' do it 'should configure nova with the basics' do
facts[:processorcount] = 10 facts[:os_workers] = 10
max_pool_size = Noop.hiera 'max_pool_size', [facts[:processorcount] * 5 + 0, 30 + 0].min max_pool_size = Noop.hiera 'max_pool_size', [facts[:os_workers] * 5 + 0, 30 + 0].min
max_overflow = Noop.hiera 'max_overflow', [facts[:processorcount] * 5 + 0, 60 + 0].min max_overflow = Noop.hiera 'max_overflow', [facts[:os_workers] * 5 + 0, 60 + 0].min
idle_timeout = Noop.hiera 'idle_timeout', '3600' idle_timeout = Noop.hiera 'idle_timeout', '3600'
max_retries = Noop.hiera 'max_retries', '-1' max_retries = Noop.hiera 'max_retries', '-1'

View File

@ -43,7 +43,8 @@ describe manifest do
dvr = na_config.fetch('neutron_dvr', false) dvr = na_config.fetch('neutron_dvr', false)
if dvr if dvr
let(:metadata_workers) do let(:metadata_workers) do
neutron_config.fetch('workers', [facts[:processorcount].to_i/8+1, workers_max.to_i].min) facts[:os_workers] = 8
neutron_config.fetch('workers', [facts[:os_workers].to_i/8+1, workers_max.to_i].min)
end end
it { should contain_class('neutron::agents::metadata').with( it { should contain_class('neutron::agents::metadata').with(
@ -78,7 +79,8 @@ describe manifest do
context 'with neutron-metadata-agent on controller' do context 'with neutron-metadata-agent on controller' do
let(:metadata_workers) do let(:metadata_workers) do
neutron_config.fetch('workers', [[facts[:processorcount].to_i, 2].max, workers_max.to_i].min) facts[:os_workers] = 8
neutron_config.fetch('workers', [[facts[:os_workers].to_i, 2].max, workers_max.to_i].min)
end end
it { should contain_class('neutron::agents::metadata').with( it { should contain_class('neutron::agents::metadata').with(

View File

@ -45,7 +45,7 @@ describe manifest do
db_user = neutron_config.fetch('database', {}).fetch('user', 'neutron') db_user = neutron_config.fetch('database', {}).fetch('user', 'neutron')
db_name = neutron_config.fetch('database', {}).fetch('name', 'neutron') db_name = neutron_config.fetch('database', {}).fetch('name', 'neutron')
db_host = neutron_config.fetch('database', {}).fetch('host', database_vip) db_host = neutron_config.fetch('database', {}).fetch('host', database_vip)
if facts[:os_package_type] == 'debian' if facts[:os_package_type] == 'debian'
extra_params = { 'charset' => 'utf8', 'read_timeout' => 60 } extra_params = { 'charset' => 'utf8', 'read_timeout' => 60 }
else else
@ -101,7 +101,7 @@ describe manifest do
auth_uri = "#{internal_auth_protocol}://#{internal_auth_endpoint}:5000/" auth_uri = "#{internal_auth_protocol}://#{internal_auth_endpoint}:5000/"
nova_admin_auth_url = "#{admin_auth_protocol}://#{admin_auth_endpoint}:35357/" nova_admin_auth_url = "#{admin_auth_protocol}://#{admin_auth_endpoint}:35357/"
workers_max = Noop.hiera('workers_max', '16') workers_max = Noop.hiera 'workers_max'
it { it {
service_workers = neutron_config.fetch('workers', [[facts[:processorcount].to_i, 1].max, workers_max.to_i].min) service_workers = neutron_config.fetch('workers', [[facts[:processorcount].to_i, 1].max, workers_max.to_i].min)

View File

@ -90,7 +90,7 @@ describe manifest do
enable = Noop.hiera_structure('sahara/enabled') enable = Noop.hiera_structure('sahara/enabled')
context 'if sahara is enabled', :if => enable do context 'if sahara is enabled', :if => enable do
it 'should declare sahara class correctly' do it 'should declare sahara class correctly' do
facts[:processorcount] = 10 facts[:os_workers] = 8
sahara_plugins = %w(ambari cdh mapr spark vanilla) sahara_plugins = %w(ambari cdh mapr spark vanilla)
sahara_user = Noop.hiera_structure('sahara/user', 'sahara') sahara_user = Noop.hiera_structure('sahara/user', 'sahara')
sahara_password = Noop.hiera_structure('sahara/user_password') sahara_password = Noop.hiera_structure('sahara/user_password')
@ -100,8 +100,8 @@ describe manifest do
db_name = Noop.hiera_structure('sahara/db_name', 'sahara') db_name = Noop.hiera_structure('sahara/db_name', 'sahara')
db_password = Noop.hiera_structure('sahara/db_password') db_password = Noop.hiera_structure('sahara/db_password')
db_host = Noop.hiera_structure('sahara/db_host', database_vip) db_host = Noop.hiera_structure('sahara/db_host', database_vip)
max_pool_size =[facts[:processorcount] * 5 + 0, 30 + 0].min max_pool_size =[facts[:os_workers] * 5 + 0, 30 + 0].min
max_overflow = [facts[:processorcount] * 5 + 0, 60 + 0].min max_overflow = [facts[:os_workers] * 5 + 0, 60 + 0].min
max_retries = '-1' max_retries = '-1'
idle_timeout = '3600' idle_timeout = '3600'
read_timeout = '60' read_timeout = '60'