From 168e81e855388a0056867a70a2f52a0d4ab78748 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20M=C3=A9ndez=20Hern=C3=A1ndez?= Date: Thu, 8 Oct 2026 14:51:12 +0200 Subject: [PATCH] Reduce Puma and Pulp worker counts for development tuning Pulp worker/Puma counts are derived from live ansible_facts (processor_nproc, memtotal_mb), not from the tuning profile, so any dev box above the bare 4-core/10GB floor scales them up automatically (e.g. foreman_puma_workers up to 12, pulp_content_service_worker_count up to 17 on an 8-core host) and OOMs on constrained development environments. Pin them to small fixed values for the development profile, the same way 6c7964810a72 already pinned Candlepin's heap. Set foreman_puma_workers, pulp_worker_count, pulp_content_service_worker_count, and pulp_api_service_worker_count all to 2, rather than deriving them from the pulp_worker_count*2+1 / +1 formulas, since the development profile just needs to be as light as possible. Co-Authored-By: Claude Sonnet 5 --- src/vars/tuning/development.yml | 6 ++++++ tests/unit/tuning_test.py | 28 +++++++++++++++++++++++----- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/vars/tuning/development.yml b/src/vars/tuning/development.yml index 7a44017a7..4e1325181 100644 --- a/src/vars/tuning/development.yml +++ b/src/vars/tuning/development.yml @@ -2,5 +2,11 @@ min_cpu_cores: 4 min_ram_mb: 10240 +foreman_puma_workers: 2 + +pulp_worker_count: 2 +pulp_content_service_worker_count: 2 +pulp_api_service_worker_count: 2 + candlepin_java_opts_xms: 512m candlepin_java_opts_xmx: 2g diff --git a/tests/unit/tuning_test.py b/tests/unit/tuning_test.py index 538449386..76abe601e 100644 --- a/tests/unit/tuning_test.py +++ b/tests/unit/tuning_test.py @@ -1,14 +1,32 @@ import os +import pytest import yaml TEST_DIR = os.path.dirname(os.path.abspath(__file__)) TUNING_DIR = os.path.abspath(os.path.join(TEST_DIR, '..', '..', 'src', 'vars', 'tuning')) -def test_development_tuning_limits_candlepin_heap(): - with open(os.path.join(TUNING_DIR, 'development.yml'), 'r') as tuning_file: - tuning = yaml.safe_load(tuning_file) +def load_tuning_profile(name): + with open(os.path.join(TUNING_DIR, f'{name}.yml'), 'r') as tuning_file: + return yaml.safe_load(tuning_file) - assert tuning['candlepin_java_opts_xms'] == '512m' - assert tuning['candlepin_java_opts_xmx'] == '2g' + +@pytest.fixture +def development_tuning(): + return load_tuning_profile('development') + + +def test_development_tuning_limits_puma_workers(development_tuning): + assert development_tuning['foreman_puma_workers'] == 2 + + +def test_development_tuning_limits_pulp_workers(development_tuning): + assert development_tuning['pulp_worker_count'] == 2 + assert development_tuning['pulp_content_service_worker_count'] == 2 + assert development_tuning['pulp_api_service_worker_count'] == 2 + + +def test_development_tuning_limits_candlepin_heap(development_tuning): + assert development_tuning['candlepin_java_opts_xms'] == '512m' + assert development_tuning['candlepin_java_opts_xmx'] == '2g'