From 86221d0df02c62379a1ba5ab221083afcccbe128 Mon Sep 17 00:00:00 2001 From: Maksym Yatsenko Date: Sat, 8 Oct 2016 02:06:17 +0300 Subject: [PATCH] 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: Idfd8e3f4fe91df7d70e8c35a491c076b0b8f2348 --- manifests/api.pp | 4 ++-- manifests/conductor.pp | 4 ++-- .../os_workers_for_worker_count-3c4240c334ddc6a7.yaml | 5 +++++ spec/classes/trove_api_spec.rb | 8 ++++---- spec/classes/trove_conductor_spec.rb | 8 ++++---- spec/classes/trove_db_postgresql_spec.rb | 2 +- spec/classes/trove_guestagent_spec.rb | 8 ++++---- spec/classes/trove_taskmanager_spec.rb | 8 ++++---- 8 files changed, 26 insertions(+), 21 deletions(-) create mode 100644 releasenotes/notes/os_workers_for_worker_count-3c4240c334ddc6a7.yaml diff --git a/manifests/api.pp b/manifests/api.pp index 21ab0c25..fb82214a 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -69,7 +69,7 @@ # # [*workers*] # (optional) Number of trove API worker processes to start -# Default: $::processorcount +# Default: $::os_workers # # [*enabled*] # (optional) Whether to enable services. @@ -156,7 +156,7 @@ class trove::api( $bind_host = '0.0.0.0', $bind_port = '8779', $backlog = '4096', - $workers = $::processorcount, + $workers = $::os_workers, $enabled = true, $purge_config = false, $cert_file = false, diff --git a/manifests/conductor.pp b/manifests/conductor.pp index 51983d71..93020759 100644 --- a/manifests/conductor.pp +++ b/manifests/conductor.pp @@ -48,7 +48,7 @@ # # [*workers*] # (optional) Number of trove conductor worker processes to start -# Default: $::processorcount +# Default: $::os_workers # # [*enable_profiler*] # (optional) If False fully disable profiling feature. @@ -75,7 +75,7 @@ class trove::conductor( $log_facility = $::os_service_default, $auth_url = 'http://localhost:5000/v2.0', $conductor_manager = 'trove.conductor.manager.Manager', - $workers = $::processorcount, + $workers = $::os_workers, $enable_profiler = $::os_service_default, $trace_sqlalchemy = $::os_service_default, # Deprecated diff --git a/releasenotes/notes/os_workers_for_worker_count-3c4240c334ddc6a7.yaml b/releasenotes/notes/os_workers_for_worker_count-3c4240c334ddc6a7.yaml new file mode 100644 index 00000000..5616f0d7 --- /dev/null +++ b/releasenotes/notes/os_workers_for_worker_count-3c4240c334ddc6a7.yaml @@ -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. diff --git a/spec/classes/trove_api_spec.rb b/spec/classes/trove_api_spec.rb index d3bd0b79..0ab44aeb 100644 --- a/spec/classes/trove_api_spec.rb +++ b/spec/classes/trove_api_spec.rb @@ -276,8 +276,8 @@ describe 'trove::api' do context 'on Debian platforms' do let :facts do @default_facts.merge({ - :osfamily => 'Debian', - :processorcount => 8, + :osfamily => 'Debian', + :os_workers => 8, }) end @@ -292,8 +292,8 @@ describe 'trove::api' do context 'on RedHat platforms' do let :facts do @default_facts.merge({ - :osfamily => 'RedHat', - :processorcount => 8, + :osfamily => 'RedHat', + :os_workers => 8, }) end diff --git a/spec/classes/trove_conductor_spec.rb b/spec/classes/trove_conductor_spec.rb index 74fa6722..3eee35f3 100644 --- a/spec/classes/trove_conductor_spec.rb +++ b/spec/classes/trove_conductor_spec.rb @@ -197,8 +197,8 @@ describe 'trove::conductor' do context 'on Debian platforms' do let :facts do @default_facts.merge({ - :osfamily => 'Debian', - :processorcount => 8, + :osfamily => 'Debian', + :os_workers => 8, }) end @@ -213,8 +213,8 @@ describe 'trove::conductor' do context 'on RedHat platforms' do let :facts do @default_facts.merge({ - :osfamily => 'RedHat', - :processorcount => 8, + :osfamily => 'RedHat', + :os_workers => 8, }) end diff --git a/spec/classes/trove_db_postgresql_spec.rb b/spec/classes/trove_db_postgresql_spec.rb index b551e2f9..74ec07ff 100644 --- a/spec/classes/trove_db_postgresql_spec.rb +++ b/spec/classes/trove_db_postgresql_spec.rb @@ -30,7 +30,7 @@ describe 'trove::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 diff --git a/spec/classes/trove_guestagent_spec.rb b/spec/classes/trove_guestagent_spec.rb index 5aa9c141..71f2ef3e 100644 --- a/spec/classes/trove_guestagent_spec.rb +++ b/spec/classes/trove_guestagent_spec.rb @@ -217,8 +217,8 @@ describe 'trove::guestagent' do context 'on Debian platforms' do let :facts do @default_facts.merge({ - :osfamily => 'Debian', - :processorcount => 8 + :osfamily => 'Debian', + :os_workers => 8 }) end @@ -233,8 +233,8 @@ describe 'trove::guestagent' do context 'on RedHat platforms' do let :facts do @default_facts.merge({ - :osfamily => 'RedHat', - :processorcount => 8 + :osfamily => 'RedHat', + :os_workers => 8 }) end diff --git a/spec/classes/trove_taskmanager_spec.rb b/spec/classes/trove_taskmanager_spec.rb index 02708083..f568e741 100644 --- a/spec/classes/trove_taskmanager_spec.rb +++ b/spec/classes/trove_taskmanager_spec.rb @@ -305,8 +305,8 @@ describe 'trove::taskmanager' do context 'on Debian platforms' do let :facts do @default_facts.merge({ - :osfamily => 'Debian', - :processorcount => 8 + :osfamily => 'Debian', + :os_workers => 8 }) end @@ -321,8 +321,8 @@ describe 'trove::taskmanager' do context 'on RedHat platforms' do let :facts do @default_facts.merge({ - :osfamily => 'RedHat', - :processorcount => 8 + :osfamily => 'RedHat', + :os_workers => 8 }) end