docs: retake replicas-lb evidence from a4ca9ef after verify

The stand was recreated from a4ca9ef (make down, make run_docker) and
all evidence of the change was taken again on it: stand, distribution,
LB errors, test-persistence, test-failover for each replica (stop and
kill), stop-one refusals, make test and student_test through the LB,
test_isolated, failure_checks and bench self-checks.

New evidence closes scenarios verify found without proof: a real git
clone on non-default ports, a hung replica (docker pause: DOWN after
7.7 s, in-flight request 504), PostgreSQL outage behind the LB, replica
tests failing against one process, aborted responses via
driver.py kill-inflight. REPORT.md gets the corrected detection
formula, the measured cost of the 1 CPU limit for Argon2id and the new
rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-10 22:09:15 +03:00
co-authored by Claude Opus 5.5
parent a4ca9ef3a7
commit cb14586a19
16 changed files with 871 additions and 489 deletions
+26 -17
View File
@@ -3,17 +3,17 @@
| | |
|---|---|
| Спеки | `student-tests` «Прогон на временной базе» — «Успешный прогон»; «Тесты реплик через балансировщик» — «Против одного процесса»; «Покрытие сценариев основных спеков» — «Сверка покрытия» |
| Change | `replicas-lb`, задача 6.1 (прогон change `instance-id-idempotency` на `af4bca0` — в истории git этого файла) |
| Дата | 2026-10-10 15:12:59 UTC, 65 с |
| Commit | `4e0cc4e` |
| Стенд | образ `mtusi-messenger:lab3` из рабочего дерева на `4e0cc4e`; временная база `test_messenger` в Postgres стенда `mtusi-lab3`, Valkey стенда; отдельный контейнер `mtusi-lab3-test-api` на `127.0.0.1:18088` с лимитами сервиса `api` (1 CPU / 512 MiB); один процесс API без балансировщика, `EXPECT_REPLICAS=1` |
| Рабочий стенд | `make run_docker` запущен (HAProxy на `127.0.0.1:8080`, `api` × 2), во время прогона не трогался: состояние и `StartedAt` всех контейнеров `mtusi-lab3` до и после совпадают |
| Change | `replicas-lb`, задачи 6.1 и 7.2 (прогон change `instance-id-idempotency` на `af4bca0` — в истории git этого файла) |
| Дата | 2026-10-10 15:51:47 UTC, 64 с |
| Commit | `a4ca9ef`, рабочее дерево чистое |
| Стенд | образ `mtusi-messenger:lab3` из рабочего дерева на `a4ca9ef`; временная база `test_messenger` в Postgres стенда `mtusi-lab3`, Valkey стенда; отдельный контейнер `mtusi-lab3-test-api` на `127.0.0.1:18088` с лимитами сервиса `api` (1 CPU / 512 MiB); один процесс API без балансировщика, `EXPECT_REPLICAS=1` |
| Рабочий стенд | `make run_docker` запущен (HAProxy на `127.0.0.1:8080`, `api` × 2), во время прогона не трогался: состояние и `StartedAt` всех контейнеров `mtusi-lab3` до и после совпадают (`diff` пуст) |
| Хост | Docker Desktop 29.8.1, macOS arm64; ВМ Docker: 12 CPU, 7,7 GiB RAM; ноутбук от батареи |
## Прогон
```text
$ make test_isolated # exit 0, 65 с
$ make test_isolated # exit 0, 64 с
[test_isolated] database=test_messenger container=mtusi-lab3-test-api base_url=http://127.0.0.1:18088
[test_isolated] build image
[test_isolated] create database test_messenger
@@ -26,19 +26,23 @@ $ make test_isolated # exit 0, 65 с
[test_isolated] make test
PASS: lab3 public API scenario; infrastructure and grading evidence remain separate.
[test_isolated] make student_test
BASE_URL=http://127.0.0.1:18088 EXPECT_REPLICAS=1 uv run pytest
collecting ... collected 146 items / 15 deselected / 131 selected
student-tests/test_api_conventions.py::test_one_instance_id_per_process PASSED [ 5%]
...
coverage: 135 scenarios in 11 specs, 123 tested (16 by make failure_checks), 12 excluded
two series of 18 requests: {'5ce3cbf0541d': 36}
race: 10 clients x 10 messages, statuses {201: 100}, max in flight 10; history: 100 messages, 100 unique ids, 4 pages by 30
username race: 10 clients, statuses {409: 9, 201: 1}, max in flight 10
key race: 10 clients, statuses {201: 10}, max in flight 10; history: 1 messages
student-tests/test_idempotency.py::test_replay_on_other_replica SKIPPED [ 53%]
...
student-tests/test_load_balancing.py::test_one_session_on_several_replicas SKIPPED [ 61%]
student-tests/test_load_balancing.py::test_write_visible_through_other_replica SKIPPED [ 62%]
...
student-tests/test_race.py::test_same_key_at_once PASSED [ 77%]
student-tests/test_race.py::test_same_key_through_replicas SKIPPED (...) [ 78%]
...
==================================== PASSES ====================================
two series of 18 requests: {'7100c439564f': 36}
SKIPPED [1] student-tests/test_idempotency.py:282: one API process (EXPECT_REPLICAS=1): replica checks need the stand with the load balancer
SKIPPED [1] student-tests/test_load_balancing.py:18: one API process (EXPECT_REPLICAS=1): replica checks need the stand with the load balancer
SKIPPED [1] student-tests/test_load_balancing.py:34: one API process (EXPECT_REPLICAS=1): replica checks need the stand with the load balancer
SKIPPED [1] student-tests/test_race.py:169: one API process (EXPECT_REPLICAS=1): replica checks need the stand with the load balancer
================ 127 passed, 4 skipped, 15 deselected in 55.62s ================
================ 127 passed, 4 skipped, 15 deselected in 56.34s ================
[test_isolated] cleanup
[test_isolated] results: {'test': 0, 'student_test': 0}
```
@@ -52,6 +56,11 @@ SKIPPED [1] student-tests/test_race.py:169: one API process (EXPECT_REPLICAS=1):
на все 36 ответов двух серий.
- 15 тестов `fault` собраны, но выполняет их только
`make failure_checks` (`failure-checks.md`).
- Прогон занял 65 с против 21 с до лимитов: контейнер API получает
лимит сервиса `api` (1 CPU), а Argon2id с `p=4` на регистрации и
входе каждого тестового пользователя идёт в одной квоте CPU.
- **Почему 64 с, а не 21 с, как до лимитов.** Контейнер получает лимит
сервиса `api` (1 CPU), а набор и smoke делают около 190 регистраций и
190 входов (`student-test-lb.md`). Каждый — хэш Argon2id с `p=4`,
около 0,14 с под лимитом вместо 0,025 с без него (`../replicas/stand.md`,
«Цена лимита 1 CPU для входа»): примерно 50 с из 56 с pytest. Через LB
те же тесты идут 21 с на двух репликах. Это следствие лимита,
оставленного осознанно (design `replicas-lb`, решение 14), а не
регрессия кода.