Let measurements pin each component to its own CPUs

Track 1 compares replica layouts that must get exactly the same CPUs,
and the load generator, balancer, Valkey and PostgreSQL must not steal
cycles from the replicas or from each other. Every service now takes
an optional cpuset from LB_CPUSET, API_CPUSET, PG_CPUSET,
VALKEY_CPUSET and K6_CPUSET. They are empty by default and compose
drops an empty cpuset, so the ordinary stand is unchanged and make
limits still passes.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Artyom
2026-10-28 20:25:23 +03:00
co-authored by Claude Opus 5.5
parent d8d551aae4
commit 107fbbbe15
3 changed files with 14 additions and 3 deletions
+7 -1
View File
@@ -13,7 +13,8 @@ API_REPLICAS=2
IDEMPOTENCY_TTL_SECONDS=86400
# Solution-specific: published LB ports, replica limits, workers and pool per replica,
# LB queue per replica, drain window before closing the listener on SIGTERM, PostgreSQL
# limits, load generator limits (profile bench), cursor key file. API_PORT/SHORTTTL_PORT of lab2 are gone:
# limits, load generator limits (profile bench), CPU pinning for track 1 measurements (empty = not
# pinned), cursor key file. API_PORT/SHORTTTL_PORT of lab2 are gone:
# only the load balancer is published.
LB_HTTP_PORT=8080
LB_STATS_PORT=8404
@@ -28,4 +29,9 @@ PG_CPUS=2
PG_MEMORY=1g
K6_CPUS=2
K6_MEMORY=512m
API_CPUSET=
LB_CPUSET=
PG_CPUSET=
VALKEY_CPUSET=
K6_CPUSET=
CURSOR_SECRET_FILE=/run/secrets/cursor_secret
+5
View File
@@ -26,6 +26,7 @@ services:
restart: unless-stopped
read_only: true
cap_drop: [ALL]
cpuset: ${LB_CPUSET:-}
deploy:
resources:
limits: {cpus: "${LB_CPUS:-1}", memory: 128m}
@@ -59,6 +60,7 @@ services:
restart: unless-stopped
read_only: true
tmpfs: [/tmp]
cpuset: ${API_CPUSET:-}
depends_on:
migrate:
condition: service_completed_successfully
@@ -111,6 +113,7 @@ services:
secrets: [postgres_password]
volumes: [pgdata:/var/lib/postgresql/data]
shm_size: 256m
cpuset: ${PG_CPUSET:-}
healthcheck:
test: ["CMD", "pg_isready", "-h", "127.0.0.1", "-U", "messenger", "-d", "messenger"]
interval: 2s
@@ -140,6 +143,7 @@ services:
- volatile-lru
secrets: [valkey.conf]
volumes: [valkeydata:/data]
cpuset: ${VALKEY_CPUSET:-}
healthcheck:
test: ["CMD-SHELL", "REDISCLI_AUTH=\"$$(sed -n 's/^requirepass //p' /run/secrets/valkey.conf)\" valkey-cli ping | grep -q PONG"]
interval: 2s
@@ -159,6 +163,7 @@ services:
BASE_URL: http://lb:8080
volumes: [./infra/k6:/scripts:ro]
networks: [edge]
cpuset: ${K6_CPUSET:-}
deploy:
resources:
limits: {cpus: "${K6_CPUS:-2}", memory: "${K6_MEMORY:-512m}"}
@@ -1,7 +1,7 @@
## 1. Стенд под измерения
- [ ] 1.1 `compose.yaml`: закрепление CPU каждого сервиса через `*_CPUSET` (пусто по умолчанию), `.env.example`
- [ ] 1.2 Проверка группы: `docker compose --profile bench config --quiet`, `make limits` по-прежнему `PASS`
- [x] 1.1 `compose.yaml`: закрепление CPU каждого сервиса через `*_CPUSET` (пусто по умолчанию), `.env.example`
- [x] 1.2 Проверка группы: `docker compose --profile bench config --quiet`, `make limits` по-прежнему `PASS`
## 2. Сэмплеры и оркестратор