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: I3d198132ab50f686e1921bfeaa73188ea7d67116
This commit is contained in:
Maksym Yatsenko
2016-10-07 13:39:11 +03:00
parent 002f2b1aa2
commit 18befb1945
7 changed files with 11 additions and 8 deletions

View File

@@ -54,7 +54,7 @@
#
# [*threads*]
# (optional) The number of threads for the vhost.
# Defaults to $::processorcount
# Defaults to $::os_workers
#
# [*ssl_cert*]
# [*ssl_key*]
@@ -90,7 +90,7 @@ class mistral::wsgi::apache (
$ssl_crl_path = undef,
$ssl_crl = undef,
$ssl_certs_dir = undef,
$threads = $::processorcount,
$threads = $::os_workers,
$priority = '10',
) {

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

@@ -108,7 +108,6 @@ describe 'mistral::api' do
:operatingsystemrelease => '8.0',
:concat_basedir => '/var/lib/puppet/concat',
:fqdn => 'some.host.tld',
:processorcount => 2,
})
end
@@ -127,7 +126,6 @@ describe 'mistral::api' do
:operatingsystemrelease => '7.1',
:fqdn => 'some.host.tld',
:concat_basedir => '/var/lib/puppet/concat',
:processorcount => 2,
})
end

View File

@@ -30,7 +30,7 @@ describe 'mistral::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

@@ -32,7 +32,7 @@ describe 'mistral::db::sync' 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

@@ -110,7 +110,7 @@ describe 'mistral::logging' do
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge(OSDefaults.get_facts({:processorcount => 8}))
facts.merge(OSDefaults.get_facts({:os_workers => 8}))
end
it_configures 'mistral-logging'

View File

@@ -4,7 +4,7 @@ describe 'mistral::wsgi::apache' do
let :global_facts do
@default_facts.merge({
:processorcount => 42,
:os_workers => 8,
:concat_basedir => '/var/lib/puppet/concat',
:fqdn => 'some.host.tld',
})