forked from mtusi2026/mtusi2026lab3
feat: implement estim 4
This commit is contained in:
+38
-9
@@ -1,18 +1,47 @@
|
||||
$ api replicas before (api_2 restored with: podman compose start api)
|
||||
messenger-lab3_api_1 hostname=0405cf8a4a54 Up 2 minutes
|
||||
messenger-lab3_api_2 hostname=2751ae93e6d1 Up 19 seconds
|
||||
|
||||
$ curl -s localhost:8080/health/live (shift round-robin so the test write lands on the other replica)
|
||||
{"status":"ok"}
|
||||
$ api replicas before
|
||||
messenger-lab3_api_2 hostname=5a9ffe83734a Up 2 minutes (healthy)
|
||||
messenger-lab3_api_1 hostname=ab01920585fe Up 4 seconds (healthy)
|
||||
|
||||
$ python3 tests/load.py --duration 30 --concurrency 4 --output evidence/failover-load-2.json & (background load during the test)
|
||||
$ podman stats --no-stream (during load, before failure)
|
||||
messenger-lab3_api_1 cpu=4.21% mem=47.89MB / 268.4MB
|
||||
messenger-lab3_api_2 cpu=5.90% mem=92.86MB / 268.4MB
|
||||
messenger-lab3_lb_1 cpu=4.60% mem=31.47MB / 67.11MB
|
||||
messenger-lab3_postgres_1 cpu=12.45% mem=148.5MB / 536.9MB
|
||||
messenger-lab3_redis_1 cpu=0.59% mem=6.611MB / 134.2MB
|
||||
|
||||
$ make test-failover ACTION_SCRIPT=scripts/stop-one.sh
|
||||
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://localhost:8080"
|
||||
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
|
||||
{"observed_instances_before": 2, "successful_writes": 81, "failed_attempts": 1, "first_recovery_seconds": 2.424}
|
||||
{"observed_instances_before": 2, "successful_writes": 132, "failed_attempts": 0, "first_recovery_seconds": 3.37}
|
||||
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
exit=0
|
||||
|
||||
$ podman stats --no-stream (during load, one replica stopped)
|
||||
messenger-lab3_api_1 cpu=7.73% mem=33.08MB / 268.4MB
|
||||
messenger-lab3_lb_1 cpu=4.84% mem=32.26MB / 67.11MB
|
||||
messenger-lab3_postgres_1 cpu=12.54% mem=146.1MB / 536.9MB
|
||||
messenger-lab3_redis_1 cpu=0.59% mem=7.373MB / 134.2MB
|
||||
|
||||
$ background tests/load.py result
|
||||
{
|
||||
"lab": 3,
|
||||
"workload": "closed-loop POST messages; no automatic retries",
|
||||
"requested_duration_seconds": 30.0,
|
||||
"elapsed_seconds": 30.013,
|
||||
"concurrency": 4,
|
||||
"successful_requests": 9508,
|
||||
"failed_requests": 0,
|
||||
"error_ratio": 0.0,
|
||||
"successful_rps": 316.791,
|
||||
"successful_latency_ms": {
|
||||
"p50": 12.105,
|
||||
"p95": 16.14,
|
||||
"p99": 22.351
|
||||
},
|
||||
"note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead."
|
||||
}
|
||||
|
||||
$ api replicas after (stopped one = TARGET_INSTANCE_ID)
|
||||
messenger-lab3_api_1 hostname=0405cf8a4a54 Exited (0) 15 seconds ago
|
||||
messenger-lab3_api_2 hostname=2751ae93e6d1 Up 35 seconds
|
||||
messenger-lab3_api_2 hostname=5a9ffe83734a Exited (0) 22 seconds ago (healthy)
|
||||
messenger-lab3_api_1 hostname=ab01920585fe Up 35 seconds (healthy)
|
||||
|
||||
Reference in New Issue
Block a user