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: I3808177027a880c88f075cdbef0aba2a56fb26bc
This commit is contained in:
Maksym Yatsenko 2016-10-04 20:42:38 +03:00
parent f4df279c4a
commit 74e52d294c
5 changed files with 12 additions and 7 deletions

View File

@ -27,7 +27,7 @@
# #
# [*workers*] # [*workers*]
# (optional) Number of Glance API worker processes to start # (optional) Number of Glance API worker processes to start
# Default: $::processorcount # Default: $::os_workers.
# #
# [*log_file*] # [*log_file*]
# (optional) The path of file used for logging # (optional) The path of file used for logging
@ -320,7 +320,7 @@ class glance::api(
$bind_host = $::os_service_default, $bind_host = $::os_service_default,
$bind_port = '9292', $bind_port = '9292',
$backlog = $::os_service_default, $backlog = $::os_service_default,
$workers = $::processorcount, $workers = $::os_workers,
$log_file = undef, $log_file = undef,
$log_dir = undef, $log_dir = undef,
$registry_host = '0.0.0.0', $registry_host = '0.0.0.0',

View File

@ -23,7 +23,7 @@
# #
# [*workers*] # [*workers*]
# (optional) Number of Glance Glare worker processes to start # (optional) Number of Glance Glare worker processes to start
# Default: $::processorcount # Default: $::os_workers.
# #
# [*auth_strategy*] # [*auth_strategy*]
# (optional) Type is authorization being used. # (optional) Type is authorization being used.
@ -134,7 +134,7 @@ class glance::glare(
$bind_host = '0.0.0.0', $bind_host = '0.0.0.0',
$bind_port = '9494', $bind_port = '9494',
$backlog = '4096', $backlog = '4096',
$workers = $::processorcount, $workers = $::os_workers,
$auth_strategy = 'keystone', $auth_strategy = 'keystone',
$pipeline = 'keystone', $pipeline = 'keystone',
$manage_service = true, $manage_service = true,

View File

@ -22,7 +22,7 @@
# [*workers*] # [*workers*]
# (optional) The number of child process workers that will be # (optional) The number of child process workers that will be
# created to service Registry requests. # created to service Registry requests.
# Defaults to: $::processorcount # Defaults to: $::os_workers.
# #
# [*log_file*] # [*log_file*]
# (optional) Log file for glance-registry. # (optional) Log file for glance-registry.
@ -174,7 +174,7 @@ class glance::registry(
$debug = undef, $debug = undef,
$bind_host = $::os_service_default, $bind_host = $::os_service_default,
$bind_port = '9191', $bind_port = '9191',
$workers = $::processorcount, $workers = $::os_workers,
$log_file = undef, $log_file = undef,
$log_dir = undef, $log_dir = undef,
$database_connection = undef, $database_connection = 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

@ -7,7 +7,7 @@ describe 'glance::registry' do
:use_stderr => '<SERVICE DEFAULT>', :use_stderr => '<SERVICE DEFAULT>',
:bind_host => '<SERVICE DEFAULT>', :bind_host => '<SERVICE DEFAULT>',
:bind_port => '9191', :bind_port => '9191',
:workers => facts[:processorcount], :workers => facts[:os_workers],
:log_file => '/var/log/glance/registry.log', :log_file => '/var/log/glance/registry.log',
:log_dir => '/var/log/glance', :log_dir => '/var/log/glance',
:enabled => true, :enabled => true,