Files
mtusi2026lab3/evidence/criteria/4-01-readiness-shutdown.md
T
2026-10-10 21:32:33 +03:00

9.0 KiB

4: readiness, DNS, таймауты и SIGTERM

Что проверяется

Параметры согласованы: проверки LB inter=1s/fall=2/rise=2, timeout check=1s; API прекращает приём при SIGTERM, завершает запросы за <=10 с; штатный stop_grace_period=15s. Проверка отказа использует консервативный бюджет исключения 6 с и измеряет его фактически. Rolling подтверждает graceful shutdown и новую DNS-адресацию.

Статус выполнения проверок: PASS. Для исследования PASS означает успешную проверку данных и правил анализа; решение гипотезы указано отдельно и может быть неопределённым.

Запуск: lab3-report-04. Команды выполнены из корня проекта в WSL; время и версии указаны в manifest.

Команды и фактический вывод

inventory

Проверка приложения.

python3 scripts/generate_evidence.py --inspect

Начало UTC: 2026-10-10T16:21:17.236315+00:00; конец UTC: 2026-10-10T16:21:18.715399+00:00; exit code: 0.

Фрагмент вывода; полный журнал доступен по ссылке ниже.

{
  "containers": [
    {
      "service": "api",
      "instance": "04f3baa4775a",
      "state": "running",
      "exit_code": 0,
      "health": "healthy",
      "cpu": 500000000,
      "memory": 134217728,
      "ports": {},
      "networks": {
        "highload-lab3_data": {
          "address": "172.25.0.5"
        },
        "highload-lab3_proxy": {
          "address": "172.24.0.3"
        }
      },
      "image": "sha256:363f45fa05716cae10a22502ffcf239d6caa1071b83ffff36f38293bfc23c01b",
      "started": "2026-10-10T16:14:19.585285959Z",
      "container_id": "04f3baa4775a9bbbdddef6946e6afd668350a2122344523620da4c9ab01b7d98",
      "gomaxprocs": "1"
    },
    {
      "service": "api",
      "instance": "4864ca4d784f",
      "state": "running",
      "exit_code": 0,
      "health": "healthy",
      "cpu": 500000000,
      "memory": 134217728,
      "ports": {},
      "networks": {
        "highload-lab3_data": {
          "address": "172.25.0.4"
        },
        "highload-lab3_proxy": {
          "address": "172.24.0.2"
        }
      },
      "image": "sha256:363f45fa05716cae10a22502ffcf239d6caa1071b83ffff36f38293bfc23c01b",
      "started": "2026-10-10T16:15:26.924492269Z",
      "container_id": "4864ca4d784f90c711346dfa3e290dfeb54e65f53dd2aa0019cf224976513cc1",
      "gomaxprocs": "1"
    },
    {
      "service": "db",
      "instance": "edfcf3091ee4",
      "state": "running",
      "exit_code": 0,
      "health": "healthy",
      "cpu": 1000000000,
      "memory": 536870912,
      "ports": {},
      "networks": {
        "highload-lab3_data": {
          "address": "172.25.0.3"
        }
      },
      "image": "sha256:38471f330eb885e04de130b768d6db4e10469e2311879c7e5c699f6d2d8a1c74",
      "started": "2026-10-10T16:14:14.990276912Z",
      "container_id": "edfcf3091ee410c68a4d6845fee0aaed1477744abba90d7b6de8dffbfe51f05c"
    },
    {
      "service": "frontend",
      "instance": "ceb091ff4cee",
      "state": "running",
      "exit_code": 0,
      "health": "healthy",
... [пропущенные строки — в полном журнале] ...
      "path": "/health/ready",
      "status": 200,
      "instance": "4864ca4d784f"
    }
  ],
  "migration_version_dirty": "3|f",
  "git_ignored": [
    ".env",
    ".memory/"
  ],
  "hook_scope": {
    "restart.sh": {
      "sha256": "0bdb05ec336f4e175ab2a76f172fcab06512003f70962adcd3e4c64567da1c43"
    },
    "stop-one.sh": {
      "sha256": "6eda7ff0eaaf521a2510e3b4ea2675ec7cd44851aeedf7300ca099ade9fa46f8"
    }
  }
}
PASS: actual containers and HAProxy addresses agree; migration 3 clean; storage/API private; secrets ignored

Полный сохранённый вывод: evidence/criteria/runs/lab3-report-04/inventory.txt.

failover

Проверка приложения.

python3 scripts/check_failover.py

Начало UTC: 2026-10-10T16:23:50.669521+00:00; конец UTC: 2026-10-10T16:24:40.149403+00:00; exit code: 0.

Вывод команды:

{"stopped_instance": "04f3baa4775a", "container_state": "exited", "successful_writes": 117, "successful_reads": 121, "write_errors": 4, "read_errors": 0, "first_write_seconds": 1.817, "first_read_seconds": 1.702, "elapsed_seconds": 15.061, "lb_exclusion_seconds": 1.806, "successful_rps": 15.802, "attempted_rps": 16.067, "workload": "one sequential writer and reader, 100ms pause; not a capacity benchmark"}
 Container highload-lab3-api-13 Running 
 Container highload-lab3-api-12 Starting 
 Container highload-lab3-api-12 Started 
 Container highload-lab3-api-13 Waiting 
 Container highload-lab3-api-12 Waiting 
 Container highload-lab3-api-13 Healthy 
 Container highload-lab3-api-12 Healthy 
{"stopped_instance": "4864ca4d784f", "container_state": "exited", "successful_writes": 118, "successful_reads": 122, "write_errors": 4, "read_errors": 0, "first_write_seconds": 1.835, "first_read_seconds": 1.722, "elapsed_seconds": 15.086, "lb_exclusion_seconds": 1.825, "successful_rps": 15.909, "attempted_rps": 16.174, "workload": "one sequential writer and reader, 100ms pause; not a capacity benchmark"}
 Container highload-lab3-api-12 Running 
 Container highload-lab3-api-13 Starting 
 Container highload-lab3-api-13 Started 
 Container highload-lab3-api-13 Waiting 
 Container highload-lab3-api-12 Waiting 
 Container highload-lab3-api-13 Healthy 
 Container highload-lab3-api-12 Healthy 
PASS: each API replica stopped in turn; reads, writes, sessions and confirmed messages preserved

Полный сохранённый вывод: evidence/criteria/runs/lab3-report-04/failover.txt.

rolling

Проверка приложения.

python3 scripts/check_rolling.py

Начало UTC: 2026-10-10T16:24:40.188049+00:00; конец UTC: 2026-10-10T16:25:08.619608+00:00; exit code: 0.

Вывод команды:

 Container highload-lab3-migrate-run-8120f6a79ab5 Creating 
 Container highload-lab3-migrate-run-8120f6a79ab5 Created 
2026/10/10 16:24:49 migration up complete
 Container highload-lab3-api-13 Running 
 Container highload-lab3-api-14 Creating 
 Container highload-lab3-api-14 Created 
 Container highload-lab3-api-14 Starting 
 Container highload-lab3-api-14 Started 
 Container highload-lab3-api-14 Waiting 
 Container highload-lab3-api-13 Waiting 
 Container highload-lab3-api-14 Healthy 
 Container highload-lab3-api-13 Healthy 
{"old_instance": "04f3baa4775a", "new_instance": "2fcedadb893e", "survivor_instance": "4864ca4d784f", "replacement_seconds": 7.733, "graceful_shutdown": true}
 Container highload-lab3-api-14 Running 
 Container highload-lab3-api-15 Creating 
 Container highload-lab3-api-15 Created 
 Container highload-lab3-api-15 Starting 
 Container highload-lab3-api-15 Started 
 Container highload-lab3-api-15 Waiting 
 Container highload-lab3-api-14 Waiting 
 Container highload-lab3-api-15 Healthy 
 Container highload-lab3-api-14 Healthy 
{"old_instance": "4864ca4d784f", "new_instance": "e057f7d85be3", "survivor_instance": "2fcedadb893e", "replacement_seconds": 7.964, "graceful_shutdown": true}
{
  "elapsed_seconds": 21.747,
  "concurrency": 4,
  "successful_writes": 1474,
  "successful_reads": 1566,
  "errors": 0,
  "successful_rps": 139.788,
  "replacements": [
    {
      "old_instance": "04f3baa4775a",
      "new_instance": "2fcedadb893e",
      "survivor_instance": "4864ca4d784f",
      "replacement_seconds": 7.733,
      "graceful_shutdown": true
    },
    {
      "old_instance": "4864ca4d784f",
      "new_instance": "e057f7d85be3",
      "survivor_instance": "2fcedadb893e",
      "replacement_seconds": 7.964,
      "graceful_shutdown": true
    }
  ],
  "confirmed_messages_preserved": true,
  "session_preserved": true,
  "workload": "two writers, two readers, 20ms pause per worker; not a capacity benchmark"
}
PASS: sequential replacement under load; all confirmed messages and sessions preserved

Полный сохранённый вывод: evidence/criteria/runs/lab3-report-04/rolling.txt.

Реализация и дополнительные доказательства