orchestrator: Cap maximum processes and threads by default

cloudkitty-orchestrator by default launches
 - N workers for rating processing
 - N workers for reprocessing
and also launch 5 * N threads in each worker.

N = Number of cpu cores

This results in huge value in case a node has relatively many cpu
cores (including pseudo cores in case hyper-threading is enabled).

Cap the maximum numbers to avoid too many processes/threads used in
node with many CPU cores.

Change-Id: Id9b2f33777db2d7265ca41e9066135b56aca34d2
Signed-off-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
This commit is contained in:
Takashi Kajinami
2025-09-08 20:49:48 +09:00
parent c1d9151756
commit 87374d71da
3 changed files with 24 additions and 11 deletions

View File

@@ -10,21 +10,21 @@
#
# [*max_workers*]
# (Optional) Maximum number of workers to execute the rating process.
# Defaults to $facts['os_service_default']
# Defaults to $facts['os_workers']
#
# [*max_workers_reprocessing*]
# (Optional) Maximum number of workers to execute the reprocessing.
# Defaults to $facts['os_service_default']
# Defaults to $facts['os_workers']
#
# [*max_threads*]
# (Optional) Maximal number of threads to use per worker.
# Defaults to $facts['os_service_default']
# (Optional) Maximum number of threads to use per worker.
# Defaults to 16,
#
class cloudkitty::orchestrator (
$coordination_url = $facts['os_service_default'],
$max_workers = $facts['os_service_default'],
$max_workers_reprocessing = $facts['os_service_default'],
$max_threads = $facts['os_service_default']
$max_workers = $facts['os_workers'],
$max_workers_reprocessing = $facts['os_workers'],
$max_threads = 16,
) {
include cloudkitty::deps

View File

@@ -0,0 +1,11 @@
---
upgrade:
- |
Default values of the following parameters have been changed to avoid
using too many processes or threads in node with many cores.
- ``cloudkitty::orchestrator::max_workers`` now defaults to
the ``os_workers`` fact.
- ``cloudkitty::orchestrator::max_workers_reprocessing`` now defaults to
the ``os_workers`` fact.
- ``cloudkitty::orchestrator::max_threads`` now defaults to `16`.

View File

@@ -14,9 +14,9 @@ describe 'cloudkitty::orchestrator' do
:backend_url => '<SERVICE DEFAULT>',
:manage_config => false,
)
is_expected.to contain_cloudkitty_config('orchestrator/max_workers').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cloudkitty_config('orchestrator/max_workers_reprocessing').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cloudkitty_config('orchestrator/max_threads').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cloudkitty_config('orchestrator/max_workers').with_value(4)
is_expected.to contain_cloudkitty_config('orchestrator/max_workers_reprocessing').with_value(4)
is_expected.to contain_cloudkitty_config('orchestrator/max_threads').with_value(16)
end
end
@@ -49,7 +49,9 @@ describe 'cloudkitty::orchestrator' do
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
facts.merge!(OSDefaults.get_facts(
:os_workers => 4,
))
end
it_configures 'cloudkitty::orchestrator'