From 1289df31b164f918788b81710a19622bd131deab Mon Sep 17 00:00:00 2001 From: CharaWein Date: Mon, 9 Nov 2026 18:12:07 +0300 Subject: [PATCH] =?UTF-8?q?worker:=20GOMEMLIMIT=20560MiB,=20=D0=B7=D0=B0?= =?UTF-8?q?=D0=BC=D0=B5=D1=80=20oom/memlimit=20=D0=B2=20limits?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 2 ++ compose.yaml | 3 +++ student-tests/pipeline_ops.py | 2 ++ 3 files changed, 7 insertions(+) diff --git a/.env.example b/.env.example index 4d51780a..fd037318 100644 --- a/.env.example +++ b/.env.example @@ -20,6 +20,8 @@ MAX_UPLOAD_BYTES=10485760 MAX_IMAGE_PIXELS=40000000 BROKER_URL_FILE=/run/secrets/broker_url WORKER_CONCURRENCY=2 +# Мягкий лимит кучи Go в worker (≈75% WORKER_MEMORY) +WORKER_GOMEMLIMIT=560MiB JOB_MAX_ATTEMPTS=5 JOB_TIMEOUT_SECONDS=60 STAGING_RETENTION_SECONDS=86400 diff --git a/compose.yaml b/compose.yaml index 8a675fad..07922908 100644 --- a/compose.yaml +++ b/compose.yaml @@ -267,6 +267,9 @@ services: CACHE_URL_FILE: "" BROKER_URL_FILE: /run/secrets/broker_url FAULT_POINTS: ${WORKER_FAULT_POINTS:-} + # Мягкий лимит кучи Go ≈ 75% лимита контейнера: без него GC (GOGC=100) даёт куче + # расти до ~2× живого объёма, и пик подходил вплотную к 768M (замер прогона 4). + GOMEMLIMIT: ${WORKER_GOMEMLIMIT:-560MiB} secrets: [database_url, s3_access_key_id, s3_secret_access_key, broker_url] healthcheck: test: ["CMD-SHELL", "pgrep -x pipeline >/dev/null || pidof pipeline >/dev/null"] diff --git a/student-tests/pipeline_ops.py b/student-tests/pipeline_ops.py index 4d86ebaf..adbf1b92 100755 --- a/student-tests/pipeline_ops.py +++ b/student-tests/pipeline_ops.py @@ -414,6 +414,8 @@ def scenario_limits(c): 'worker_anon_memory_max_mib': round(anon_max[0] / 1048576, 1), 'worker_memory_peak_incl_page_cache_mib': round(int(peak) / 1048576, 1) if peak.isdigit() else peak, 'oom_kill_events': oom.get('oom_kill', 0), + 'go_memlimit': sh('docker', 'exec', cid, 'printenv', 'GOMEMLIMIT', check=False).stdout.strip(), + 'oom_events': oom.get('oom', 0), 'worker_memory_limit_mib': round(int(limit) / 1048576, 1) if limit.isdigit() else limit, 'pixel_budget': 60_000_000, 'decoded_rgba_per_image_mib': round(6000 * 6000 * 4 / 1048576, 1), 'variant_sizes': th}