forked from mtusi2026/mtusi2026lab2
Implement lab 2 PostgreSQL sessions and Redis profile cache
This commit is contained in:
@@ -0,0 +1 @@
|
||||
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"observed_at": "2026-11-19T07:45:37.469958+00:00",
|
||||
"platform": "Windows-11-10.0.26200-SP0",
|
||||
"cpu": "Intel64 Family 6 Model 186 Stepping 2, GenuineIntel",
|
||||
"logical_cpus": 16,
|
||||
"python": "3.12.3"
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"lab": 2,
|
||||
"workload": "closed-loop POST messages; no automatic retries",
|
||||
"requested_duration_seconds": 30.0,
|
||||
"elapsed_seconds": 30.141,
|
||||
"concurrency": 4,
|
||||
"successful_requests": 6843,
|
||||
"failed_requests": 0,
|
||||
"error_ratio": 0.0,
|
||||
"successful_rps": 227.033,
|
||||
"successful_latency_ms": {
|
||||
"p50": 16.0,
|
||||
"p95": 32.0,
|
||||
"p99": 47.0
|
||||
},
|
||||
"note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead."
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"lab": 2,
|
||||
"workload": "closed-loop POST messages; no automatic retries",
|
||||
"requested_duration_seconds": 30.0,
|
||||
"elapsed_seconds": 30.141,
|
||||
"concurrency": 4,
|
||||
"successful_requests": 6843,
|
||||
"failed_requests": 0,
|
||||
"error_ratio": 0.0,
|
||||
"successful_rps": 227.033,
|
||||
"successful_latency_ms": {
|
||||
"p50": 16.0,
|
||||
"p95": 32.0,
|
||||
"p99": 47.0
|
||||
},
|
||||
"note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead."
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
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,79 @@
|
||||
{
|
||||
"dataset_messages": 12000,
|
||||
"cursor_position": 10001,
|
||||
"page_size_with_lookahead": 51,
|
||||
"plan": [
|
||||
{
|
||||
"Plan": {
|
||||
"Node Type": "Limit",
|
||||
"Parallel Aware": false,
|
||||
"Async Capable": false,
|
||||
"Startup Cost": 0.29,
|
||||
"Total Cost": 9.88,
|
||||
"Plan Rows": 51,
|
||||
"Plan Width": 69,
|
||||
"Actual Startup Time": 0.034,
|
||||
"Actual Total Time": 0.07,
|
||||
"Actual Rows": 51,
|
||||
"Actual Loops": 1,
|
||||
"Shared Hit Blocks": 4,
|
||||
"Shared Read Blocks": 0,
|
||||
"Shared Dirtied Blocks": 0,
|
||||
"Shared Written Blocks": 0,
|
||||
"Local Hit Blocks": 0,
|
||||
"Local Read Blocks": 0,
|
||||
"Local Dirtied Blocks": 0,
|
||||
"Local Written Blocks": 0,
|
||||
"Temp Read Blocks": 0,
|
||||
"Temp Written Blocks": 0,
|
||||
"Plans": [
|
||||
{
|
||||
"Node Type": "Index Scan",
|
||||
"Parent Relationship": "Outer",
|
||||
"Parallel Aware": false,
|
||||
"Async Capable": false,
|
||||
"Scan Direction": "Forward",
|
||||
"Index Name": "messages_history",
|
||||
"Relation Name": "messages",
|
||||
"Alias": "messages",
|
||||
"Startup Cost": 0.29,
|
||||
"Total Cost": 376.82,
|
||||
"Plan Rows": 2002,
|
||||
"Plan Width": 69,
|
||||
"Actual Startup Time": 0.031,
|
||||
"Actual Total Time": 0.055,
|
||||
"Actual Rows": 51,
|
||||
"Actual Loops": 1,
|
||||
"Index Cond": "((chat_id = 'eae5d1d7-e003-4d8c-a4c1-f37ad80710a2'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.010001+00'::timestamp with time zone, 'f0612713-b9fe-4956-aa1c-cf82a0a2b6d1'::uuid)))",
|
||||
"Rows Removed by Index Recheck": 0,
|
||||
"Shared Hit Blocks": 4,
|
||||
"Shared Read Blocks": 0,
|
||||
"Shared Dirtied Blocks": 0,
|
||||
"Shared Written Blocks": 0,
|
||||
"Local Hit Blocks": 0,
|
||||
"Local Read Blocks": 0,
|
||||
"Local Dirtied Blocks": 0,
|
||||
"Local Written Blocks": 0,
|
||||
"Temp Read Blocks": 0,
|
||||
"Temp Written Blocks": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
"Planning": {
|
||||
"Shared Hit Blocks": 6,
|
||||
"Shared Read Blocks": 0,
|
||||
"Shared Dirtied Blocks": 0,
|
||||
"Shared Written Blocks": 0,
|
||||
"Local Hit Blocks": 0,
|
||||
"Local Read Blocks": 0,
|
||||
"Local Dirtied Blocks": 0,
|
||||
"Local Written Blocks": 0,
|
||||
"Temp Read Blocks": 0,
|
||||
"Temp Written Blocks": 0
|
||||
},
|
||||
"Planning Time": 0.444,
|
||||
"Triggers": [],
|
||||
"Execution Time": 0.278
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
[
|
||||
{
|
||||
"at": "2026-11-19T07:45:07.042984+00:00",
|
||||
"stats": "vp-lab2-api-1: CPU=51.83% RAM=191.3MiB / 512MiB\nvp-lab2-db-1: CPU=30.30% RAM=36.62MiB / 512MiB\nvp-lab2-redis-1: CPU=0.35% RAM=8.184MiB / 128MiB"
|
||||
},
|
||||
{
|
||||
"at": "2026-11-19T07:45:11.716348+00:00",
|
||||
"stats": "vp-lab2-api-1: CPU=129.85% RAM=191.4MiB / 512MiB\nvp-lab2-db-1: CPU=31.61% RAM=36.92MiB / 512MiB\nvp-lab2-redis-1: CPU=0.30% RAM=8.309MiB / 128MiB"
|
||||
},
|
||||
{
|
||||
"at": "2026-11-19T07:45:16.440752+00:00",
|
||||
"stats": "vp-lab2-api-1: CPU=120.48% RAM=198.5MiB / 512MiB\nvp-lab2-db-1: CPU=28.59% RAM=37.76MiB / 512MiB\nvp-lab2-redis-1: CPU=0.30% RAM=8.18MiB / 128MiB"
|
||||
},
|
||||
{
|
||||
"at": "2026-11-19T07:45:21.214682+00:00",
|
||||
"stats": "vp-lab2-api-1: CPU=116.05% RAM=194.3MiB / 512MiB\nvp-lab2-db-1: CPU=36.85% RAM=38.11MiB / 512MiB\nvp-lab2-redis-1: CPU=0.34% RAM=8.312MiB / 128MiB"
|
||||
},
|
||||
{
|
||||
"at": "2026-11-19T07:45:26.096036+00:00",
|
||||
"stats": "vp-lab2-api-1: CPU=110.50% RAM=194.3MiB / 512MiB\nvp-lab2-db-1: CPU=32.46% RAM=38.22MiB / 512MiB\nvp-lab2-redis-1: CPU=0.46% RAM=8.184MiB / 128MiB"
|
||||
},
|
||||
{
|
||||
"at": "2026-11-19T07:45:30.786451+00:00",
|
||||
"stats": "vp-lab2-api-1: CPU=106.21% RAM=194.3MiB / 512MiB\nvp-lab2-db-1: CPU=25.58% RAM=39.02MiB / 512MiB\nvp-lab2-redis-1: CPU=0.49% RAM=8.184MiB / 128MiB"
|
||||
},
|
||||
{
|
||||
"at": "2026-11-19T07:45:35.469509+00:00",
|
||||
"stats": "vp-lab2-api-1: CPU=97.16% RAM=194.4MiB / 512MiB\nvp-lab2-db-1: CPU=25.32% RAM=39.2MiB / 512MiB\nvp-lab2-redis-1: CPU=0.35% RAM=8.184MiB / 128MiB"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"before": [
|
||||
{
|
||||
"name": "/vp-lab2-api-1",
|
||||
"id": "51df1ca0997fb8365713bda1153f7b7ebef1318d8fe7ae6114cc4279bd83114f",
|
||||
"started_at": "2026-11-19T07:44:22.242015528Z",
|
||||
"image": "vp-lab2-api"
|
||||
},
|
||||
{
|
||||
"name": "/vp-lab2-db-1",
|
||||
"id": "a4de1828985dbb6c23694508e62dbd58e8fac0c8227dbee0b86af55b7f6d7296",
|
||||
"started_at": "2026-11-19T07:40:10.782456786Z",
|
||||
"image": "postgres:16.6-bookworm"
|
||||
},
|
||||
{
|
||||
"name": "/vp-lab2-redis-1",
|
||||
"id": "cdd92a6517e3be5377b268f66e5ddf3ac650e3e60c87ef091555f25dc25e7440",
|
||||
"started_at": "2026-11-19T07:41:58.069227011Z",
|
||||
"image": "redis:7.4.1-bookworm"
|
||||
}
|
||||
],
|
||||
"after": [
|
||||
{
|
||||
"name": "/vp-lab2-api-1",
|
||||
"id": "51df1ca0997fb8365713bda1153f7b7ebef1318d8fe7ae6114cc4279bd83114f",
|
||||
"started_at": "2026-11-19T07:44:33.62888078Z",
|
||||
"image": "vp-lab2-api"
|
||||
},
|
||||
{
|
||||
"name": "/vp-lab2-db-1",
|
||||
"id": "a4de1828985dbb6c23694508e62dbd58e8fac0c8227dbee0b86af55b7f6d7296",
|
||||
"started_at": "2026-11-19T07:44:33.00388505Z",
|
||||
"image": "postgres:16.6-bookworm"
|
||||
},
|
||||
{
|
||||
"name": "/vp-lab2-redis-1",
|
||||
"id": "cdd92a6517e3be5377b268f66e5ddf3ac650e3e60c87ef091555f25dc25e7440",
|
||||
"started_at": "2026-11-19T07:44:33.018097101Z",
|
||||
"image": "redis:7.4.1-bookworm"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
PASS: lab2 public API scenario; infrastructure and grading evidence remain separate.
|
||||
@@ -0,0 +1,42 @@
|
||||
[
|
||||
{
|
||||
"test": "concurrent registration: one 201, seven 409",
|
||||
"result": "PASS"
|
||||
},
|
||||
{
|
||||
"test": "foreign-key failure rolls back chat and first member",
|
||||
"result": "PASS"
|
||||
},
|
||||
{
|
||||
"test": "strict payload validation and authentication before resource access",
|
||||
"result": "PASS"
|
||||
},
|
||||
{
|
||||
"test": "keyset pagination, changing limit, cross-chat cursor rejection",
|
||||
"result": "PASS"
|
||||
},
|
||||
{
|
||||
"test": "equal timestamps use UUID tie breaker",
|
||||
"result": "PASS"
|
||||
},
|
||||
{
|
||||
"test": "Unicode/colon password, wrong password, cache TTL and logout with warm cache",
|
||||
"result": "PASS"
|
||||
},
|
||||
{
|
||||
"test": "Redis outage falls back safely and cache recovers",
|
||||
"result": "PASS"
|
||||
},
|
||||
{
|
||||
"test": "DB outage fails closed with 503; same session works after recovery",
|
||||
"result": "PASS"
|
||||
},
|
||||
{
|
||||
"test": "SESSION_TTL_SECONDS=2 expires a warm-cache session",
|
||||
"result": "PASS"
|
||||
},
|
||||
{
|
||||
"test": "migrations are repeatable without duplicate data",
|
||||
"result": "PASS"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,10 @@
|
||||
PASS: concurrent registration: one 201, seven 409
|
||||
PASS: foreign-key failure rolls back chat and first member
|
||||
PASS: strict payload validation and authentication before resource access
|
||||
PASS: keyset pagination, changing limit, cross-chat cursor rejection
|
||||
PASS: equal timestamps use UUID tie breaker
|
||||
PASS: Unicode/colon password, wrong password, cache TTL and logout with warm cache
|
||||
PASS: Redis outage falls back safely and cache recovers
|
||||
PASS: DB outage fails closed with 503; same session works after recovery
|
||||
PASS: SESSION_TTL_SECONDS=2 expires a warm-cache session
|
||||
PASS: migrations are repeatable without duplicate data
|
||||
Reference in New Issue
Block a user