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: I4a9b2e6cc9d8f5b91f148ac61b4a36b201a27056
This commit is contained in:
Maksym Yatsenko 2016-10-07 17:26:02 +03:00
parent 7afd77efda
commit 866aabb8bd
11 changed files with 24 additions and 19 deletions

View File

@ -67,7 +67,7 @@
#
# [*threads*]
# (optional) The number of threads for the vhost.
# Defaults to $::processorcount
# Defaults to $::os_workers
#
# [*wsgi_script_ensure*]
# (optional) File ensure parameter for wsgi scripts.
@ -127,7 +127,7 @@ class barbican::wsgi::apache (
$ssl_crl_path = undef,
$ssl_crl = undef,
$ssl_certs_dir = undef,
$threads = $::processorcount,
$threads = $::os_workers,
$priority = '10',
$wsgi_script_ensure = 'file',
$wsgi_script_source = undef,

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

@ -24,8 +24,8 @@ describe 'barbican::api' do
let :facts do
@default_facts.merge(
OSDefaults.get_facts({
:osfamily => 'RedHat',
:processorcount => '7',
:osfamily => 'RedHat',
:os_workers => '7',
})
)
end

View File

@ -49,7 +49,7 @@ describe 'barbican::db::postgresql' do
context "on #{os}" do
let (:facts) do
facts.merge(OSDefaults.get_facts({
:processorcount => 8,
:os_workers => 8,
:concat_basedir => '/var/lib/puppet/concat'
}))
end

View File

@ -24,8 +24,8 @@ describe 'barbican::keystone::notification' do
let :facts do
@default_facts.merge(
{
:osfamily => 'RedHat',
:processorcount => '7',
:osfamily => 'RedHat',
:os_workers => '7',
}
)
end

View File

@ -24,8 +24,8 @@ describe 'barbican::plugins::dogtag' do
let :facts do
@default_facts.merge(
{
:osfamily => 'RedHat',
:processorcount => '7',
:osfamily => 'RedHat',
:os_workers => '7',
}
)
end

View File

@ -24,8 +24,8 @@ describe 'barbican::plugins::kmip' do
let :facts do
@default_facts.merge(
{
:osfamily => 'RedHat',
:processorcount => '7',
:osfamily => 'RedHat',
:os_workers => '7',
}
)
end

View File

@ -24,8 +24,8 @@ describe 'barbican::plugins::p11_crypto' do
let :facts do
@default_facts.merge(
{
:osfamily => 'RedHat',
:processorcount => '7',
:osfamily => 'RedHat',
:os_workers => '7',
}
)
end

View File

@ -24,8 +24,8 @@ describe 'barbican::plugins::simple_crypto' do
let :facts do
@default_facts.merge(
{
:osfamily => 'RedHat',
:processorcount => '7',
:osfamily => 'RedHat',
:os_workers => '7',
}
)
end

View File

@ -24,8 +24,8 @@ describe 'barbican::quota' do
let :facts do
@default_facts.merge(
{
:osfamily => 'RedHat',
:processorcount => '7',
:osfamily => 'RedHat',
:os_workers => '7',
}
)
end

View File

@ -58,7 +58,7 @@ describe 'barbican::wsgi::apache' do
'user' => 'barbican',
'group' => 'barbican',
'processes' => '1',
'threads' => '42',
'threads' => '8',
'display-name' => 'barbican-api',
},
'wsgi_process_group' => 'barbican-api',
@ -109,7 +109,7 @@ describe 'barbican::wsgi::apache' do
}).each do |os,facts|
let (:facts) do
facts.merge!(OSDefaults.get_facts({
:processorcount => 42,
:os_workers => 8,
:concat_basedir => '/var/lib/puppet/concat',
:fqdn => 'some.host.tld'
}))