lab4: доказательства и отчёт

This commit is contained in:
Vladislav Kunetskiy
2026-10-21 22:42:48 +03:00
parent 49c2fe3071
commit 3389c6c900
17 changed files with 270 additions and 29 deletions
+28
View File
@@ -0,0 +1,28 @@
# Lab4 evidence
All files were produced on the local Compose stand (`docker compose up -d --build`)
with SeaweedFS 3.80, two API replicas and HAProxy.
| File | Scenario | Command |
|---|---|---|
| `smoke.txt` | Public cumulative smoke (LAB=4) | `make test` |
| `negative.txt` | Size/format/filename/authz/limits | `make test-attachments` |
| `presign.txt` | Presigned upload happy path and negatives | `make test-presign` |
| `expiry.txt` | Expired presigned URL (TTL=3s) | `PRESIGN_EXPIRY_WAIT=4 make test-presign` |
| `failover.txt` | Upload, stop the serving replica, download via another | `python3 student-tests/attachment_failover.py` |
| `persistence.txt` | Restart the stand with volumes | `make test-persistence ACTION_SCRIPT=scripts/restart.sh` |
| `s3-init.txt` | Idempotent bucket bootstrap, app/forbidden prefix probes | `docker compose run --rm s3-init` (twice) |
| `private-bucket.txt` | Anonymous S3 GET and published ports | `docker compose exec seaweedfs wget ...` |
| `s3-outage.txt` | S3 down: attachments 503, other endpoints 200 | `docker compose stop seaweedfs` |
| `sweep.txt` | Abandoned presign cleanup after grace; ready survives | `S3_SWEEP_GRACE=2s S3_SWEEP_INTERVAL=1s` |
| `memory/` | 10 concurrent 9.4 MiB uploads, cgroup memory samples | `python3 scripts/lab4_memory_experiment.py` |
| `track1/` | Proxy vs presigned upload: traffic, latency, memory | `python3 scripts/lab4_track1.py` |
Notes:
- Credentials are synthetic local values from `infra/s3/s3.json`; `.env` is
ignored by git.
- `memory.current` includes page cache from temporary spool files; `anon` is
the primary RAM metric.
- Presigned completion re-reads the object once to verify SHA-256, so API RX
stays close to the file size. The client-facing LB leg is the actual saving.
+3
View File
@@ -0,0 +1,3 @@
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1 python3 student-tests/presign_flow.py --base-url "http://localhost:8080"
EXPIRED: presigned URL rejected after 4.0 seconds
PASS: lab4 presigned upload flow
+1
View File
@@ -0,0 +1 @@
PASS: lab4 attachment failover; served by cbc4cbeea6da
+5
View File
@@ -0,0 +1,5 @@
elapsed,phase,anon,current
0.367,during,281419776,386904064
1.063,during,281698304,384315392
1.689,during,281784320,369328128
2.139,during,281849856,290664448
1 elapsed phase anon current
2 0.367 during 281419776 386904064
3 1.063 during 281698304 384315392
4 1.689 during 281784320 369328128
5 2.139 during 281849856 290664448
+11
View File
@@ -0,0 +1,11 @@
Lab4 memory experiment
concurrency: 10
file_size_bytes: 9454448
uploads: 30
rounds: 3
elapsed_seconds: 2.097
baseline_anon_bytes: 279879680
peak_anon_bytes: 281849856
anon_delta_bytes: 1970176
peak_memory_current_bytes: 386904064
note: memory.current includes page cache from temporary spool files; anon is the primary metric
+2
View File
@@ -0,0 +1,2 @@
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1 python3 student-tests/attachments_negative.py --base-url "http://localhost:8080"
PASS: lab4 attachment negative scenarios
+3
View File
@@ -0,0 +1,3 @@
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1 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.
+2
View File
@@ -0,0 +1,2 @@
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1 python3 student-tests/presign_flow.py --base-url "http://localhost:8080"
PASS: lab4 presigned upload flow
+10
View File
@@ -0,0 +1,10 @@
=== anonymous GET ===
wget: server returned error: HTTP/1.1 403 Forbidden
exit=1
=== published ports ===
api 8080/tcp
api 8080/tcp
lb 127.0.0.1:8404->8404/tcp, 127.0.0.1:8080->80/tcp
postgres 5432/tcp
redis 6379/tcp
seaweedfs 7333/tcp, 8080/tcp, 8888/tcp, 9333/tcp, 18080/tcp, 18888/tcp, 19333/tcp, 127.0.0.1:8333->8333/tcp
+14
View File
@@ -0,0 +1,14 @@
=== run 1 ===
Container mtusi-messenger-lab4-seaweedfs-1 Running
Container mtusi-messenger-lab4-seaweedfs-1 Waiting
Container mtusi-messenger-lab4-seaweedfs-1 Healthy
Container mtusi-messenger-lab4-s3-init-run-6d633e58a067 Creating
Container mtusi-messenger-lab4-s3-init-run-6d633e58a067 Created
{"time":"2026-10-21T19:37:16.099886123Z","level":"INFO","msg":"s3 bucket ready","endpoint":"http://seaweedfs:8333","bucket":"messenger-attachments"}
=== run 2 (idempotent) ===
Container mtusi-messenger-lab4-seaweedfs-1 Running
Container mtusi-messenger-lab4-seaweedfs-1 Waiting
Container mtusi-messenger-lab4-seaweedfs-1 Healthy
Container mtusi-messenger-lab4-s3-init-run-a60a52baaf22 Creating
Container mtusi-messenger-lab4-s3-init-run-a60a52baaf22 Created
{"time":"2026-10-21T19:37:16.941920617Z","level":"INFO","msg":"s3 bucket ready","endpoint":"http://seaweedfs:8333","bucket":"messenger-attachments"}
+8
View File
@@ -0,0 +1,8 @@
created attachment before outage: 01a15ff7-e2fe-7a6c-b896-c61c3451a6c5
seaweedfs stopped
health/ready during outage: {'status': 'ok'}
chat list during outage: 200
download during outage: 503
upload during outage: 503
seaweedfs restarted
upload after recovery: ready 01a15ff8-6610-7628-a06a-26e590c6186b
+2
View File
@@ -0,0 +1,2 @@
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1 python3 tests/smoke.py --base-url "http://localhost:8080"
PASS: lab4 public API scenario; infrastructure and grading evidence remain separate.
+5
View File
@@ -0,0 +1,5 @@
ready attachment created: 01a15ff8-9634-77d1-b7e2-cd5831a19d49
abandoned presign attachment: 01a15ff8-9639-7e03-a71c-2971e9425972 (no PUT)
abandoned pending row removed after grace
ready attachment survived sweep: ready 99ea7533c441f79cd630d15ce4d58d1ec4e06f6f0efb3b77a5c088305cd1bd75
sweeper settings restored (10m/1m)
+21
View File
@@ -0,0 +1,21 @@
size,bytes,flow,iteration,latency_s,lb_rx_bytes,lb_tx_bytes,api_rx_bytes,api_tx_bytes,api_anon_peak
~1MiB,1050888,proxy,0,0.2246,1059079,1059227,1059155,1060779,282734592
~1MiB,1050888,proxy,1,0.2436,1057539,1058793,1058440,1058956,282742784
~1MiB,1050888,proxy,2,0.2276,1058111,1058605,1059413,1060497,282763264
~1MiB,1050888,proxy,3,0.2225,1056087,1058199,1058375,1058314,282767360
~1MiB,1050888,proxy,4,0.2267,1057825,1059425,1058752,1059718,282771456
~1MiB,1050888,presign,0,0.2196,3464,3596,1058037,9166,282787840
~1MiB,1050888,presign,1,0.2249,3465,3729,1057424,9073,282836992
~1MiB,1050888,presign,2,0.2171,4015,3833,1058301,8969,282849280
~1MiB,1050888,presign,3,0.2276,3465,3597,1057489,8774,282865664
~1MiB,1050888,presign,4,0.2327,4631,4333,1057989,9060,282877952
~9MiB,9454448,proxy,0,0.2375,9490073,9512447,9506779,9489274,282886144
~9MiB,9454448,proxy,1,0.2365,9488841,9503073,9493951,9486796,282882048
~9MiB,9454448,proxy,2,0.2353,9489017,9505121,9505811,9490554,282890240
~9MiB,9454448,proxy,3,0.2282,9491723,9501595,9500701,9493150,282906624
~9MiB,9454448,proxy,4,0.229,9493835,9509411,9500971,9489868,282918912
~9MiB,9454448,presign,0,0.2359,3465,3663,9473260,11216,282935296
~9MiB,9454448,presign,1,0.235,4014,3832,9473694,11664,282968064
~9MiB,9454448,presign,2,0.2391,3465,3795,9473579,13975,283009024
~9MiB,9454448,presign,3,0.2504,4564,4068,9473083,14572,283045888
~9MiB,9454448,presign,4,0.2353,3465,3597,9473381,12391,283054080
1 size bytes flow iteration latency_s lb_rx_bytes lb_tx_bytes api_rx_bytes api_tx_bytes api_anon_peak
2 ~1MiB 1050888 proxy 0 0.2246 1059079 1059227 1059155 1060779 282734592
3 ~1MiB 1050888 proxy 1 0.2436 1057539 1058793 1058440 1058956 282742784
4 ~1MiB 1050888 proxy 2 0.2276 1058111 1058605 1059413 1060497 282763264
5 ~1MiB 1050888 proxy 3 0.2225 1056087 1058199 1058375 1058314 282767360
6 ~1MiB 1050888 proxy 4 0.2267 1057825 1059425 1058752 1059718 282771456
7 ~1MiB 1050888 presign 0 0.2196 3464 3596 1058037 9166 282787840
8 ~1MiB 1050888 presign 1 0.2249 3465 3729 1057424 9073 282836992
9 ~1MiB 1050888 presign 2 0.2171 4015 3833 1058301 8969 282849280
10 ~1MiB 1050888 presign 3 0.2276 3465 3597 1057489 8774 282865664
11 ~1MiB 1050888 presign 4 0.2327 4631 4333 1057989 9060 282877952
12 ~9MiB 9454448 proxy 0 0.2375 9490073 9512447 9506779 9489274 282886144
13 ~9MiB 9454448 proxy 1 0.2365 9488841 9503073 9493951 9486796 282882048
14 ~9MiB 9454448 proxy 2 0.2353 9489017 9505121 9505811 9490554 282890240
15 ~9MiB 9454448 proxy 3 0.2282 9491723 9501595 9500701 9493150 282906624
16 ~9MiB 9454448 proxy 4 0.229 9493835 9509411 9500971 9489868 282918912
17 ~9MiB 9454448 presign 0 0.2359 3465 3663 9473260 11216 282935296
18 ~9MiB 9454448 presign 1 0.235 4014 3832 9473694 11664 282968064
19 ~9MiB 9454448 presign 2 0.2391 3465 3795 9473579 13975 283009024
20 ~9MiB 9454448 presign 3 0.2504 4564 4068 9473083 14572 283045888
21 ~9MiB 9454448 presign 4 0.2353 3465 3597 9473381 12391 283054080
+12
View File
@@ -0,0 +1,12 @@
Lab4 track 1: proxy vs presigned upload
| size | flow | median latency, s | p95 latency, s | LB rx, bytes | API rx, bytes | API anon peak, bytes |
|---|---|---:|---:|---:|---:|---:|
| ~1MiB | proxy | 0.227 | 0.244 | 1057728 | 1058827 | 282771456 |
| ~1MiB | presign | 0.225 | 0.233 | 3808 | 1057848 | 282877952 |
| ~9MiB | proxy | 0.235 | 0.237 | 9490698 | 9501643 | 282918912 |
| ~9MiB | presign | 0.236 | 0.250 | 3795 | 9473399 | 283054080 |
Note: presigned upload keeps the file body off the API request path and off the load balancer.
Completion still streams the object from S3 once to verify its SHA-256, so api_rx stays close to
the file size; the saving is in the client-facing LB leg and in not accepting/buffering the body.