forked from mtusi2026/mtusi2026lab3
79 lines
3.0 KiB
Markdown
79 lines
3.0 KiB
Markdown
# Результаты проверок лабораторной 3
|
|
|
|
Повторная проверка: 2026-10-16. Платформа: Docker Desktop на macOS arm64. Ветка: `solution/BVT2303-Merkulova`.
|
|
|
|
## Сборка и контракт
|
|
|
|
```text
|
|
$ go test ./...
|
|
ok mtusi-messenger/internal/messenger
|
|
|
|
$ go vet ./...
|
|
(ошибок нет)
|
|
|
|
$ make check
|
|
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
|
|
|
|
$ make test
|
|
PASS: lab3 public API scenario; infrastructure and grading evidence remain separate.
|
|
```
|
|
|
|
Шесть последовательных запросов через единственный публичный порт Nginx вернули `api-2`, `api-1`, `api-2`, `api-1`, `api-2`, `api-1`.
|
|
|
|
## Persistence и официальный failover
|
|
|
|
```text
|
|
$ ACTION_SCRIPT=./scripts/restart.sh make test-persistence
|
|
PASS: persistence preserved confirmed data and existing session.
|
|
```
|
|
|
|
Официальный failover после изменения Nginx: две реплики наблюдались до отказа, 126 записей успешны, ошибок 0, first recovery 0.834 s. После этого `failover_experiment.py` последовательно остановил `api1` и `api2`, каждый раз восстанавливая предыдущую реплику.
|
|
|
|
## Собственные проверки уровня 4
|
|
|
|
```text
|
|
$ python3 student-tests/verify_idempotency.py
|
|
PASS: 12 parallel requests; instances api-1/api-2; one unique message; conflict=409
|
|
|
|
$ python3 student-tests/failover_experiment.py
|
|
PASS: api-1 5143/0, 642.783 RPS, 0.600 s
|
|
PASS: api-2 4560/0, 569.984 RPS, 0.610 s
|
|
|
|
$ python3 student-tests/verify_unready_backend.py
|
|
PASS: api1 unhealthy with frontend connection; 40 GETs and 10 POSTs served by api2
|
|
|
|
$ python3 student-tests/rolling_update_experiment.py
|
|
PASS: 25388 successful, 0 failed, 1508.329 RPS
|
|
p50=2.221 ms p95=3.998 ms p99=6.040 ms
|
|
instances=api-1,api-2
|
|
```
|
|
|
|
Сырые безопасные summaries: `idempotency.json`, `failover-grade4.json`, `rolling-update.json`.
|
|
|
|
## Сохранённые проверки lab2
|
|
|
|
```text
|
|
$ python3 student-tests/verify_grade4.py
|
|
PASS: registration race, transaction rollback, bad password and logout
|
|
|
|
$ python3 student-tests/verify_expiry.py
|
|
PASS: two-second Redis session expired and was rejected
|
|
|
|
$ python3 student-tests/verify_dependencies.py
|
|
PASS: Redis/PostgreSQL failures returned 503; anonymous access stayed 401; state recovered
|
|
```
|
|
|
|
## Ресурсные limits
|
|
|
|
```text
|
|
api1 cpu=500000000 memory=201326592
|
|
api2 cpu=500000000 memory=201326592
|
|
nginx cpu=250000000 memory=67108864
|
|
postgres cpu=1000000000 memory=536870912
|
|
redis cpu=250000000 memory=134217728
|
|
```
|
|
|
|
## SQL-план
|
|
|
|
`./scripts/explain_history.sh` создал 10 000 сообщений. PostgreSQL выбрал `Index Scan using messages_chat_history_idx`; execution time данного локального запуска с прогретым cache — 0.028 ms. Полный вывод находится в `explain-history.txt`.
|