PostgreSQL connection tuning for Sysinv

This change updates the default values for the database connection pool
parameters in Sysinv application. The reduction of maximum pool size and
maximum overflow value can consequently produce a memory usage reduction.
These values changes produced a reduction between 14.1 and 20.7% of ap-
plication's original memory allocation.

To enable easy management, this change also allows the parameter's
control through service-parameters command.

This change affects only AIO systems. For distributed cloud, this change
only affects subclouds.

TEST PLAN:
PASS: (AIO-SX, DX, DX+, and Standard) Bootstrap system.
PASS: (AIO-SX, DX, DX+, and Standard) Run application in idle state,
      check memory usage and error-free operation.
PASS: (AIO-SX, DX, DX+, and Standard) Run application with workload,
      check memory usage and error-free operation.
PASS: Successfully executed administrative operations (lock, unlock,
      and swact - only for duplex and Standard systems).

Story: 2011374
Task: 51771

Change-Id: Ia8b202568c2177eac65fc16edf43a53edb1b324b
Signed-off-by: Eduardo Alberti <eduardo.alberti@windriver.com>
This commit is contained in:
Eduardo Alberti 2025-02-21 13:52:37 -03:00
parent 052751c3df
commit dd9d7c4131

View File

@ -5,7 +5,26 @@ class platform::sysinv::params (
$fm_catalog_info = 'faultmanagement:fm:internalURL',
$server_timeout = '600s',
$sysinv_api_workers = undef,
) { }
) {
# Set default values for database connection for AIO systems (except for
# systemcontroller on DC)
if ($::platform::params::system_type == 'All-in-one' and
$::platform::params::distributed_cloud_role != 'systemcontroller') {
$db_idle_timeout = 60
$db_pool_size = 1
$db_over_size = 5
} else {
$db_idle_timeout = undef
$db_pool_size = undef
$db_over_size = undef
}
}
class platform::sysinv::custom::params (
$db_idle_timeout = undef,
$db_pool_size = undef,
$db_over_size = undef,
) {}
class platform::sysinv
inherits ::platform::sysinv::params {
@ -14,6 +33,7 @@ class platform::sysinv
include ::platform::params
include ::platform::drbd::platform::params
include ::platform::sysinv::custom::params
# sysinv-agent is started on all hosts
include ::sysinv::agent
@ -68,8 +88,38 @@ class platform::sysinv
'app_framework/missing_auto_update': value => true;
'app_framework/skip_k8s_application_audit': value => false;
}
}
# On AIO systems, restrict the connection pool size
# If database information doesn't exist in yaml file, use default values
$sel_db_idle_timeout = pick_default(
$::platform::sysinv::custom::params::db_idle_timeout,
$db_idle_timeout,
undef)
$sel_db_pool_size = pick_default(
$::platform::sysinv::custom::params::db_pool_size,
$db_pool_size,
undef)
$sel_db_over_size = pick_default(
$::platform::sysinv::custom::params::db_over_size,
$db_over_size,
undef)
if $sel_db_pool_size != undef {
Sysinv_config <| title == 'database/max_pool_size' |> {
value => $sel_db_pool_size,
}
}
if $sel_db_over_size != undef {
Sysinv_config <| title == 'database/max_overflow' |> {
value => $sel_db_over_size,
}
}
if $sel_db_idle_timeout != undef {
Sysinv_config <| title == 'database/connection_recycle_time' |> {
value => $sel_db_idle_timeout,
}
}
}
class platform::sysinv::conductor {