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: Iae9e5c6e5a5f68cb7f0a0dfc0edb0d21912cda19
This commit is contained in:
Maksym Yatsenko
2016-10-08 00:46:22 +03:00
committed by Alex Schultz
parent c19a798b68
commit 718be4c871
6 changed files with 13 additions and 9 deletions

View File

@@ -20,7 +20,7 @@
#
# [*workers*]
# (optional) Number of workers for Gnocchi API server.
# Defaults to $::processorcount
# Defaults to $::os_workers
#
# [*max_limit*]
# (optional) The maximum number of items returned in a
@@ -83,7 +83,7 @@ class gnocchi::api (
$package_ensure = 'present',
$host = '0.0.0.0',
$port = '8041',
$workers = $::processorcount,
$workers = $::os_workers,
$max_limit = 1000,
$service_name = $::gnocchi::params::api_service_name,
$sync_db = false,

View File

@@ -46,7 +46,7 @@
#
# [*workers*]
# Number of WSGI workers to spawn.
# Optional. Defaults to max(($::processorcount + 0)/4, 2)
# Optional. Defaults to $::os_workers
#
# [*priority*]
# (optional) The priority for the vhost.
@@ -82,7 +82,7 @@ class gnocchi::wsgi::apache (
$bind_host = undef,
$path = '/',
$ssl = true,
$workers = max(($::processorcount + 0)/4, 2),
$workers = $::os_workers,
$ssl_cert = undef,
$ssl_key = undef,
$ssl_chain = 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

@@ -160,7 +160,6 @@ describe 'gnocchi::api' do
let (:facts) do
facts.merge!(OSDefaults.get_facts({
:concat_basedir => '/var/lib/puppet/concat',
:processorcount => 2
}))
end

View File

@@ -36,7 +36,7 @@ describe 'gnocchi::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

@@ -57,7 +57,7 @@ describe 'gnocchi::wsgi::apache' do
:bind_host => '10.42.51.1',
:port => 12345,
:ssl => false,
:workers => 37,
:workers => 8,
:threads => 2,
}
end
@@ -73,7 +73,7 @@ describe 'gnocchi::wsgi::apache' do
'wsgi_daemon_process_options' => {
'user' => 'gnocchi',
'group' => 'gnocchi',
'processes' => '37',
'processes' => '8',
'threads' => '2',
},
'wsgi_daemon_process' => 'gnocchi',
@@ -92,7 +92,7 @@ describe 'gnocchi::wsgi::apache' do
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts({
:processorcount => 16,
:os_workers => 4,
:concat_basedir => '/var/lib/puppet/concat',
:fqdn => 'some.host.tld',
}))