forked from mtusi2026/mtusi2026lab2
lab2
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"backup_seconds": 1.032968691,
|
||||
"new_server_start_seconds": 5.76950239,
|
||||
"restore_seconds": 1.109244704,
|
||||
"restore_project": "lab2-restore-1790966246-29166",
|
||||
"backup_bytes": 3208212,
|
||||
"stand": "Docker Compose, PostgreSQL 16.9"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"redis_offline_scenario_seconds": 3.0654408010013867,
|
||||
"db_offline_scenario_seconds": 0.023503273994720075,
|
||||
"status": "PASS"
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
bash scripts/backup_restore.sh
|
||||
Network lab2-restore-1790966246-29166_default Creating
|
||||
Network lab2-restore-1790966246-29166_default Created
|
||||
Volume "lab2-restore-1790966246-29166_redis_data" Creating
|
||||
Volume "lab2-restore-1790966246-29166_redis_data" Created
|
||||
Volume "lab2-restore-1790966246-29166_restored_data" Creating
|
||||
Volume "lab2-restore-1790966246-29166_restored_data" Created
|
||||
Volume "lab2-restore-1790966246-29166_postgres_data" Creating
|
||||
Volume "lab2-restore-1790966246-29166_postgres_data" Created
|
||||
Container lab2-restore-1790966246-29166-restored-1 Creating
|
||||
Container lab2-restore-1790966246-29166-restored-1 Created
|
||||
Container lab2-restore-1790966246-29166-restored-1 Starting
|
||||
Container lab2-restore-1790966246-29166-restored-1 Started
|
||||
Container lab2-restore-1790966246-29166-restored-1 Waiting
|
||||
Container lab2-restore-1790966246-29166-restored-1 Healthy
|
||||
#0 building with "default" instance using docker driver
|
||||
|
||||
#1 [api internal] load build definition from Dockerfile
|
||||
#1 transferring dockerfile: 1.04kB done
|
||||
#1 DONE 0.0s
|
||||
|
||||
#2 [api internal] load metadata for docker.io/library/python:3.12.10-slim-bookworm
|
||||
#2 DONE 0.7s
|
||||
|
||||
#3 [api internal] load .dockerignore
|
||||
#3 transferring context: 212B done
|
||||
#3 DONE 0.0s
|
||||
|
||||
#4 [api 1/12] FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db
|
||||
#4 DONE 0.0s
|
||||
|
||||
#5 [api internal] load build context
|
||||
#5 transferring context: 1.72kB done
|
||||
#5 DONE 0.0s
|
||||
|
||||
#6 [api 8/12] COPY --chown=app:app student-tests ./student-tests
|
||||
#6 CACHED
|
||||
|
||||
#7 [api 11/12] COPY --chown=app:app lab.json ./lab.json
|
||||
#7 CACHED
|
||||
|
||||
#8 [api 6/12] COPY --chown=app:app migrations ./migrations
|
||||
#8 CACHED
|
||||
|
||||
#9 [api 9/12] COPY --chown=app:app tests ./tests
|
||||
#9 CACHED
|
||||
|
||||
#10 [api 3/12] COPY requirements.txt .
|
||||
#10 CACHED
|
||||
|
||||
#11 [api 2/12] WORKDIR /app
|
||||
#11 CACHED
|
||||
|
||||
#12 [api 7/12] COPY --chown=app:app scripts ./scripts
|
||||
#12 CACHED
|
||||
|
||||
#13 [api 10/12] COPY --chown=app:app contracts ./contracts
|
||||
#13 CACHED
|
||||
|
||||
#14 [api 4/12] RUN pip install --no-cache-dir --requirement requirements.txt && groupadd --system --gid 10001 app && useradd --system --uid 10001 --gid app --home-dir /nonexistent --shell /usr/sbin/nologin app
|
||||
#14 CACHED
|
||||
|
||||
#15 [api 5/12] COPY --chown=app:app src ./src
|
||||
#15 CACHED
|
||||
|
||||
#16 [api 12/12] RUN mkdir -p evidence && chown app:app evidence
|
||||
#16 CACHED
|
||||
|
||||
#17 [api] exporting to image
|
||||
#17 exporting layers done
|
||||
#17 writing image sha256:f76f54e85211d83d610b5efc29d630111b5c3ad92f5d76edbce24a7b39d9ba94 done
|
||||
#17 naming to docker.io/library/lab2-restore-1790966246-29166-api done
|
||||
#17 DONE 0.0s
|
||||
PASS: restored row counts and selected full messages match backup dataset
|
||||
Container lab2-restore-1790966246-29166-restored-1 Stopping
|
||||
Container lab2-restore-1790966246-29166-restored-1 Stopped
|
||||
PASS: restored into separate PostgreSQL and volume; project=lab2-restore-1790966246-29166
|
||||
@@ -0,0 +1,2 @@
|
||||
python3 scripts/check_contract.py
|
||||
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
|
||||
@@ -0,0 +1,2 @@
|
||||
python3 student-tests/dependencies.py --base-url "http://localhost:8080" --stop-cache scripts/stop-cache.sh --start-cache scripts/start-cache.sh --stop-db scripts/stop-db.sh --start-db scripts/start-db.sh
|
||||
PASS: Redis fallback + restart + logout; DB bounded 503 + recovery; anonymous rejected
|
||||
@@ -0,0 +1,75 @@
|
||||
2026-10-02T21:38:57+03:00
|
||||
Linux LAPTOP-66HKAM8B 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
|
||||
Architecture: x86_64
|
||||
CPU op-mode(s): 32-bit, 64-bit
|
||||
Address sizes: 39 bits physical, 48 bits virtual
|
||||
Byte Order: Little Endian
|
||||
CPU(s): 16
|
||||
On-line CPU(s) list: 0-15
|
||||
Vendor ID: GenuineIntel
|
||||
Model name: 12th Gen Intel(R) Core(TM) i5-1240P
|
||||
CPU family: 6
|
||||
Model: 154
|
||||
Thread(s) per core: 2
|
||||
Core(s) per socket: 8
|
||||
Socket(s): 1
|
||||
Stepping: 3
|
||||
BogoMIPS: 4224.01
|
||||
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology tsc_reliable nonstop_tsc cpuid pni pclmulqdq vmx ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves avx_vnni umip waitpkg gfni vaes vpclmulqdq rdpid movdiri movdir64b fsrm md_clear serialize flush_l1d arch_capabilities
|
||||
Virtualization: VT-x
|
||||
Hypervisor vendor: Microsoft
|
||||
Virtualization type: full
|
||||
L1d cache: 384 KiB (8 instances)
|
||||
L1i cache: 256 KiB (8 instances)
|
||||
L2 cache: 10 MiB (8 instances)
|
||||
L3 cache: 12 MiB (1 instance)
|
||||
Vulnerability Gather data sampling: Not affected
|
||||
Vulnerability Itlb multihit: Not affected
|
||||
Vulnerability L1tf: Not affected
|
||||
Vulnerability Mds: Not affected
|
||||
Vulnerability Meltdown: Not affected
|
||||
Vulnerability Mmio stale data: Not affected
|
||||
Vulnerability Retbleed: Mitigation; Enhanced IBRS
|
||||
Vulnerability Spec rstack overflow: Not affected
|
||||
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
|
||||
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
|
||||
Vulnerability Spectre v2: Mitigation; Enhanced IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS SW sequence
|
||||
Vulnerability Srbds: Not affected
|
||||
Vulnerability Tsx async abort: Not affected
|
||||
total used free shared buff/cache available
|
||||
Mem: 7.6Gi 1.0Gi 2.7Gi 49Mi 3.9Gi 6.3Gi
|
||||
Swap: 2.0Gi 0B 2.0Gi
|
||||
Python 3.10.12
|
||||
Docker version 28.0.1, build 068a01e
|
||||
Docker Compose version v2.27.0-desktop.2
|
||||
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
|
||||
mtusi2026lab2-api-1 mtusi2026lab2-api "sh -c 'exec uvicorn…" api 2 minutes ago Up 2 minutes (healthy) 127.0.0.1:8080->8080/tcp
|
||||
mtusi2026lab2-cache-1 redis:7.4.3-bookworm "docker-entrypoint.s…" cache 16 minutes ago Up 3 minutes (healthy) 6379/tcp
|
||||
mtusi2026lab2-db-1 postgres:16.9-bookworm "docker-entrypoint.s…" db 16 minutes ago Up 3 minutes (healthy) 5432/tcp
|
||||
Python 3.12.10
|
||||
version
|
||||
---------------------------------------------------------------------------------------------------------------------
|
||||
PostgreSQL 16.9 (Debian 16.9-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
|
||||
(1 row)
|
||||
|
||||
shared_buffers
|
||||
----------------
|
||||
128MB
|
||||
(1 row)
|
||||
|
||||
work_mem
|
||||
----------
|
||||
4MB
|
||||
(1 row)
|
||||
|
||||
fsync
|
||||
-------
|
||||
on
|
||||
(1 row)
|
||||
|
||||
synchronous_commit
|
||||
--------------------
|
||||
on
|
||||
(1 row)
|
||||
|
||||
Redis server v=7.4.3 sha=00000000:0 malloc=jemalloc-5.3.0 bits=64 build=33b32145ce3464c9
|
||||
@@ -0,0 +1,2 @@
|
||||
docker compose run --rm -T --no-deps --user "1000:1000" -v "/home/kitsune/visotka/mtusi2026lab2/evidence:/app/evidence" api python -m scripts.experiment
|
||||
PASS: measured two indexes, two queries, write cost; raw evidence saved
|
||||
@@ -0,0 +1,11 @@
|
||||
bash scripts/test_expiry.sh
|
||||
Container mtusi2026lab2-api-1 Recreate
|
||||
Container mtusi2026lab2-api-1 Recreated
|
||||
Container mtusi2026lab2-api-1 Starting
|
||||
Container mtusi2026lab2-api-1 Started
|
||||
API ready
|
||||
PASS: short TTL expiry
|
||||
Container mtusi2026lab2-api-1 Recreate
|
||||
Container mtusi2026lab2-api-1 Recreated
|
||||
Container mtusi2026lab2-api-1 Starting
|
||||
Container mtusi2026lab2-api-1 Started
|
||||
@@ -0,0 +1,2 @@
|
||||
python3 tests/smoke.py --base-url "http://localhost:8080"
|
||||
PASS: lab2 public API scenario; infrastructure and grading evidence remain separate.
|
||||
@@ -0,0 +1,3 @@
|
||||
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://localhost:8080"
|
||||
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
|
||||
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
@@ -0,0 +1,2 @@
|
||||
BASE_URL="http://localhost:8080" python3 scripts/wait_ready.py
|
||||
API ready
|
||||
@@ -0,0 +1,4 @@
|
||||
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
|
||||
mtusi2026lab2-api-1 mtusi2026lab2-api "sh -c 'exec uvicorn…" api 10 seconds ago Up 8 seconds (healthy) 127.0.0.1:8080->8080/tcp
|
||||
mtusi2026lab2-cache-1 redis:7.4.3-bookworm "docker-entrypoint.s…" cache 4 minutes ago Up 4 minutes (healthy) 6379/tcp
|
||||
mtusi2026lab2-db-1 postgres:16.9-bookworm "docker-entrypoint.s…" db 4 minutes ago Up 4 minutes (healthy) 5432/tcp
|
||||
@@ -0,0 +1,2 @@
|
||||
python3 tests/smoke.py --base-url "http://localhost:8080"
|
||||
PASS: lab2 public API scenario; infrastructure and grading evidence remain separate.
|
||||
@@ -0,0 +1,2 @@
|
||||
python3 tests/smoke.py --base-url "http://localhost:8080"
|
||||
PASS: lab2 public API scenario; infrastructure and grading evidence remain separate.
|
||||
@@ -0,0 +1,10 @@
|
||||
python3 student-tests/checks.py --base-url "http://localhost:8080"
|
||||
PASS: registration race, invalid input, cursor scope, read-after-write, logout
|
||||
python3 student-tests/test_api.py --base-url "http://localhost:8080"
|
||||
PASS: malformed JSON/media type, duplicate username, blank message, outsider access, pagination
|
||||
PASS: 10 clients created exactly 100 unique messages
|
||||
docker compose exec -T api python student-tests/database.py
|
||||
PASS: rollback of chat + members; migration reapplied twice
|
||||
docker compose exec -T api python student-tests/test_lifecycle.py
|
||||
PASS: SIGTERM completed in 0.166s (limit 10s); listener closed
|
||||
PASS: user and existing Bearer session survived API process restart
|
||||
@@ -0,0 +1,2 @@
|
||||
python3 scripts/validate_openapi.py
|
||||
PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested.
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"counts": {
|
||||
"users": 1,
|
||||
"chats": 5,
|
||||
"chat_members": 5,
|
||||
"messages": 100000,
|
||||
"sessions": 0
|
||||
},
|
||||
"sample_messages_matched": 5,
|
||||
"status": "PASS"
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,73 @@
|
||||
# Трек 2: измерения
|
||||
|
||||
Исходных сообщений: 100000. Прогрев: 5; повторов: 30.
|
||||
|
||||
| Чат | Позиция | Индекс | Запрос | p50, мс | p95, мс |
|
||||
|---:|---:|---|---|---:|---:|
|
||||
| 100 | 0 | chat_only | keyset | 0.458 | 1.033 |
|
||||
| 100 | 0 | chat_only | offset | 0.595 | 3.031 |
|
||||
| 100 | 0 | history | keyset | 0.827 | 0.988 |
|
||||
| 100 | 0 | history | offset | 0.916 | 1.616 |
|
||||
| 100 | 49 | chat_only | keyset | 0.648 | 0.844 |
|
||||
| 100 | 49 | chat_only | offset | 0.577 | 0.891 |
|
||||
| 100 | 49 | history | keyset | 0.481 | 0.519 |
|
||||
| 100 | 49 | history | offset | 0.423 | 0.531 |
|
||||
| 100 | 89 | chat_only | keyset | 0.439 | 0.999 |
|
||||
| 100 | 89 | chat_only | offset | 0.390 | 0.601 |
|
||||
| 100 | 89 | history | keyset | 0.189 | 0.276 |
|
||||
| 100 | 89 | history | offset | 0.208 | 0.704 |
|
||||
| 900 | 0 | chat_only | keyset | 0.588 | 0.975 |
|
||||
| 900 | 0 | chat_only | offset | 0.538 | 0.784 |
|
||||
| 900 | 0 | history | keyset | 0.697 | 0.834 |
|
||||
| 900 | 0 | history | offset | 0.847 | 0.965 |
|
||||
| 900 | 449 | chat_only | keyset | 0.621 | 1.117 |
|
||||
| 900 | 449 | chat_only | offset | 0.661 | 0.996 |
|
||||
| 900 | 449 | history | keyset | 0.452 | 0.644 |
|
||||
| 900 | 449 | history | offset | 0.522 | 0.699 |
|
||||
| 900 | 809 | chat_only | keyset | 0.966 | 1.164 |
|
||||
| 900 | 809 | chat_only | offset | 0.968 | 1.112 |
|
||||
| 900 | 809 | history | keyset | 0.396 | 0.767 |
|
||||
| 900 | 809 | history | offset | 0.602 | 2.982 |
|
||||
| 9000 | 0 | chat_only | keyset | 2.414 | 3.626 |
|
||||
| 9000 | 0 | chat_only | offset | 2.415 | 2.716 |
|
||||
| 9000 | 0 | history | keyset | 0.573 | 0.969 |
|
||||
| 9000 | 0 | history | offset | 0.617 | 0.825 |
|
||||
| 9000 | 4499 | chat_only | keyset | 2.262 | 3.937 |
|
||||
| 9000 | 4499 | chat_only | offset | 2.456 | 3.302 |
|
||||
| 9000 | 4499 | history | keyset | 0.394 | 0.845 |
|
||||
| 9000 | 4499 | history | offset | 1.126 | 1.725 |
|
||||
| 9000 | 8099 | chat_only | keyset | 2.697 | 3.257 |
|
||||
| 9000 | 8099 | chat_only | offset | 2.488 | 3.299 |
|
||||
| 9000 | 8099 | history | keyset | 0.381 | 0.635 |
|
||||
| 9000 | 8099 | history | offset | 1.337 | 1.553 |
|
||||
| 20000 | 0 | chat_only | keyset | 4.656 | 6.722 |
|
||||
| 20000 | 0 | chat_only | offset | 3.398 | 4.022 |
|
||||
| 20000 | 0 | history | keyset | 0.365 | 0.726 |
|
||||
| 20000 | 0 | history | offset | 0.376 | 0.652 |
|
||||
| 20000 | 9999 | chat_only | keyset | 4.222 | 5.626 |
|
||||
| 20000 | 9999 | chat_only | offset | 9.230 | 10.648 |
|
||||
| 20000 | 9999 | history | keyset | 0.565 | 0.710 |
|
||||
| 20000 | 9999 | history | offset | 1.455 | 1.614 |
|
||||
| 20000 | 17999 | chat_only | keyset | 4.339 | 6.111 |
|
||||
| 20000 | 17999 | chat_only | offset | 9.855 | 11.566 |
|
||||
| 20000 | 17999 | history | keyset | 0.470 | 0.660 |
|
||||
| 20000 | 17999 | history | offset | 2.578 | 5.871 |
|
||||
| 70000 | 0 | chat_only | keyset | 12.649 | 14.819 |
|
||||
| 70000 | 0 | chat_only | offset | 11.156 | 12.819 |
|
||||
| 70000 | 0 | history | keyset | 0.508 | 1.204 |
|
||||
| 70000 | 0 | history | offset | 0.375 | 0.594 |
|
||||
| 70000 | 34999 | chat_only | keyset | 13.197 | 16.115 |
|
||||
| 70000 | 34999 | chat_only | offset | 35.551 | 279.058 |
|
||||
| 70000 | 34999 | history | keyset | 0.370 | 0.435 |
|
||||
| 70000 | 34999 | history | offset | 4.444 | 5.365 |
|
||||
| 70000 | 62999 | chat_only | keyset | 12.574 | 16.630 |
|
||||
| 70000 | 62999 | chat_only | offset | 39.608 | 46.870 |
|
||||
| 70000 | 62999 | history | keyset | 0.741 | 0.982 |
|
||||
| 70000 | 62999 | history | offset | 10.017 | 14.338 |
|
||||
|
||||
Цена записи: 5 транзакций по 1000 строк (COPY + COMMIT).
|
||||
|
||||
| Индекс | Медиана партии, мс | Размер, байт |
|
||||
|---|---:|---:|
|
||||
| chat_only | 29.870 | 720896 |
|
||||
| history | 33.735 | 5914624 |
|
||||
Reference in New Issue
Block a user