diff --git a/.env.example b/.env.example index 91f9ec42..540a8ca5 100644 --- a/.env.example +++ b/.env.example @@ -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 diff --git a/compose.yaml b/compose.yaml index b413aecb..30402ae5 100644 --- a/compose.yaml +++ b/compose.yaml @@ -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}"} diff --git a/openspec/changes/add-lab3-scaling-cost/tasks.md b/openspec/changes/add-lab3-scaling-cost/tasks.md index 618b54f7..b07ce578 100644 --- a/openspec/changes/add-lab3-scaling-cost/tasks.md +++ b/openspec/changes/add-lab3-scaling-cost/tasks.md @@ -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. Сэмплеры и оркестратор