From 03f82512a5c10f983d22dd98d9bbb13a97335c07 Mon Sep 17 00:00:00 2001 From: Maksym Yatsenko Date: Sat, 8 Oct 2016 01:22:21 +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: Ia95c6b93fa7d2d53eb6fd1dfc6a3106e38d4ce63 --- manifests/api.pp | 4 ++-- manifests/wsgi/apache.pp | 4 ++-- .../notes/os_workers_for_worker_count-377cfa64e935822c.yaml | 5 +++++ spec/classes/panko_api_spec.rb | 1 - spec/classes/panko_wsgi_apache_spec.rb | 4 ++-- 5 files changed, 11 insertions(+), 7 deletions(-) create mode 100644 releasenotes/notes/os_workers_for_worker_count-377cfa64e935822c.yaml diff --git a/manifests/api.pp b/manifests/api.pp index 06e43d6..75df084 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -20,7 +20,7 @@ # # [*workers*] # (optional) Number of workers for Panko API server. -# Defaults to $::processorcount +# Defaults to $::os_workers # # [*max_limit*] # (optional) The maximum number of items returned in a @@ -55,7 +55,7 @@ class panko::api ( $package_ensure = 'present', $host = '0.0.0.0', $port = '8779', - $workers = $::processorcount, + $workers = $::os_workers, $max_limit = 1000, $service_name = $::panko::params::api_service_name, $sync_db = false, diff --git a/manifests/wsgi/apache.pp b/manifests/wsgi/apache.pp index 2db980c..ab01025 100644 --- a/manifests/wsgi/apache.pp +++ b/manifests/wsgi/apache.pp @@ -51,7 +51,7 @@ # # [*threads*] # (optional) The number of threads for the vhost. -# Defaults to $::processorcount +# Defaults to $::os_workers # # [*ssl_cert*] # [*ssl_key*] @@ -87,7 +87,7 @@ class panko::wsgi::apache ( $ssl_crl_path = undef, $ssl_crl = undef, $ssl_certs_dir = undef, - $threads = $::processorcount, + $threads = $::os_workers, $priority = '10', ) { diff --git a/releasenotes/notes/os_workers_for_worker_count-377cfa64e935822c.yaml b/releasenotes/notes/os_workers_for_worker_count-377cfa64e935822c.yaml new file mode 100644 index 0000000..5616f0d --- /dev/null +++ b/releasenotes/notes/os_workers_for_worker_count-377cfa64e935822c.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/panko_api_spec.rb b/spec/classes/panko_api_spec.rb index 64bf444..31d3413 100644 --- a/spec/classes/panko_api_spec.rb +++ b/spec/classes/panko_api_spec.rb @@ -155,7 +155,6 @@ describe 'panko::api' do let (:facts) do facts.merge!(OSDefaults.get_facts({ :concat_basedir => '/var/lib/puppet/concat', - :processorcount => 2 })) end diff --git a/spec/classes/panko_wsgi_apache_spec.rb b/spec/classes/panko_wsgi_apache_spec.rb index 252193c..709eacf 100644 --- a/spec/classes/panko_wsgi_apache_spec.rb +++ b/spec/classes/panko_wsgi_apache_spec.rb @@ -51,7 +51,7 @@ describe 'panko::wsgi::apache' do :bind_host => '10.42.51.1', :port => 12345, :ssl => false, - :workers => 37, + :workers => 8, } end @@ -79,7 +79,7 @@ describe 'panko::wsgi::apache' do context "on #{os}" do let (:facts) do facts.merge!(OSDefaults.get_facts({ - :processorcount => 42, + :os_workers => 4, :concat_basedir => '/var/lib/puppet/concat', :fqdn => 'some.host.tld', }))