feat: add track 1 series db with a tight PostgreSQL CPU limit
Configs may carry a fifth element, the PostgreSQL CPU limit, which goes into the config key (-pg<CPU>), the budget and the cell stand. Series db: 1, 2, 4 replicas at the tight limit and a 4 x 1 control at 2 CPU; label summaries show PostgreSQL CPU at R* against its limit and throttling. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+48
-7
@@ -318,7 +318,8 @@ class Profile:
|
||||
# как у образа; у ячейки серии — из конфигурации
|
||||
db_max_connections: int = 100
|
||||
series: str = ""
|
||||
configs: tuple[tuple[int, str, str, int], ...] = ()
|
||||
# у серии db — пятый элемент: CPU PostgreSQL конфигурации
|
||||
configs: tuple[tuple[Any, ...], ...] = ()
|
||||
write_chats: int = 1
|
||||
mix: tuple[tuple[str, float], ...] = ()
|
||||
fixed_rps: tuple[int, ...] = ()
|
||||
@@ -527,7 +528,7 @@ PROFILES = {
|
||||
def scaling_profile(
|
||||
name: str,
|
||||
series: str,
|
||||
configs: tuple[tuple[int, str, str, int], ...],
|
||||
configs: tuple[tuple[Any, ...], ...],
|
||||
**fields: Any,
|
||||
) -> Profile:
|
||||
"""Профиль серии трека 1: общие поля всех серий в одном месте, чтобы
|
||||
@@ -570,6 +571,14 @@ def scaling_profile(
|
||||
|
||||
|
||||
B_CONFIGS = tuple((k, "1", "512m", 100) for k in range(1, 7))
|
||||
# серия db: CPU PostgreSQL у 1, 2 и 4 реплик и контроль 4 × 1 при 2 CPU
|
||||
DB_CPUS_TIGHT = "0.5"
|
||||
DB_CONFIGS = (
|
||||
(1, "1", "512m", 100, DB_CPUS_TIGHT),
|
||||
(2, "1", "512m", 100, DB_CPUS_TIGHT),
|
||||
(4, "1", "512m", 100, DB_CPUS_TIGHT),
|
||||
(4, "1", "512m", 100, "2"),
|
||||
)
|
||||
PROFILES.update(
|
||||
{
|
||||
# фиксированный бюджет приложения 4 CPU / 2 ГиБ
|
||||
@@ -606,18 +615,45 @@ PROFILES.update(
|
||||
bisect_steps=1,
|
||||
max_steps=6,
|
||||
),
|
||||
# насыщение PostgreSQL управляемым опытом (verify S2, указание
|
||||
# пользователя 2026-10-11): 1, 2 и 4 реплики при узком лимите CPU
|
||||
# PostgreSQL и контроль — 4 реплики при прежних 2 CPU. Пятый
|
||||
# элемент конфигурации — CPU PostgreSQL; лимит — по калибровке
|
||||
# (design, «Найдено в verify»)
|
||||
"scaling_db": scaling_profile(
|
||||
"scaling_db",
|
||||
"db",
|
||||
DB_CONFIGS,
|
||||
),
|
||||
# самопроверка серии db и калибровка лимита: 2 и 4 реплики при
|
||||
# узком лимите, один повтор, короткие окна
|
||||
"scaling_db_quick": scaling_profile(
|
||||
"scaling_db_quick",
|
||||
"db_quick",
|
||||
DB_CONFIGS[1:3],
|
||||
sizes=(2_000,),
|
||||
repeats=1,
|
||||
fixed_rps=(250,),
|
||||
first_warmup_s=8,
|
||||
step_warmup_s=3,
|
||||
step_measure_s=8,
|
||||
bisect_steps=1,
|
||||
max_steps=6,
|
||||
),
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
def cell_profile(profile: Profile, cell: dict[str, Any]) -> Profile:
|
||||
"""Профиль ячейки: реплики и max_connections из конфигурации."""
|
||||
"""Профиль ячейки: реплики, max_connections и (серия db) CPU
|
||||
PostgreSQL из конфигурации."""
|
||||
return replace(
|
||||
profile,
|
||||
replicas=cell["replicas"],
|
||||
cpus=cell["replica_cpus"],
|
||||
memory=cell["replica_memory"],
|
||||
db_max_connections=cell["db_max_connections"],
|
||||
db_cpus=cell.get("db_cpus") or profile.db_cpus,
|
||||
)
|
||||
|
||||
|
||||
@@ -625,12 +661,14 @@ def budget(profile: Profile, vm_cpus: int, vm_memory: int) -> dict[str, Any]:
|
||||
"""Сумма лимитов CPU и памяти стенда и генератора по конфигурациям
|
||||
серии (решение 1): реплики, PostgreSQL, LB, Valkey, k6, сэмплер."""
|
||||
result = {}
|
||||
for replicas, cpus, memory, max_conn in profile.configs:
|
||||
key = scaling.config_key(replicas, cpus, memory, max_conn)
|
||||
for config in profile.configs:
|
||||
parts = scaling.unpack_config(config)
|
||||
replicas, cpus, memory, _, db_cpus = parts
|
||||
key = scaling.config_key(*parts)
|
||||
cpu = replicas * float(cpus) + sum(
|
||||
float(value)
|
||||
for value in (
|
||||
profile.db_cpus,
|
||||
db_cpus or profile.db_cpus,
|
||||
profile.lb_cpus,
|
||||
profile.cache_cpus,
|
||||
profile.generator_cpus or "0",
|
||||
@@ -845,7 +883,10 @@ def vm_warnings(profile: Profile) -> list[str]:
|
||||
return []
|
||||
replicas = [(profile.replicas, profile.memory)]
|
||||
if profile.is_series:
|
||||
replicas = [(k, memory) for k, _, memory, _ in profile.configs]
|
||||
replicas = [
|
||||
(k, memory)
|
||||
for k, _, memory, *_ in map(scaling.unpack_config, profile.configs)
|
||||
]
|
||||
extra = (
|
||||
(profile.generator_memory, profile.sampler_memory)
|
||||
if profile.is_series
|
||||
|
||||
Reference in New Issue
Block a user