26 lines
1.0 KiB
Plaintext
26 lines
1.0 KiB
Plaintext
Date: 2026-10-08
|
|
Track: 1 — cache consistency
|
|
Environment: Docker Engine 29.8.0; PostgreSQL 17.6; Redis 7.4.2;
|
|
Python 3.12.12; 10 CPU; 16 GiB RAM.
|
|
|
|
Method:
|
|
student-tests/cache_stampede.py creates a new chat with one message and
|
|
launches 20 concurrent GET requests for its cold first history page.
|
|
The API logs one history_sql_page_load per PostgreSQL page query.
|
|
|
|
Baseline: CACHE_STAMPEDE_PROTECTION=false
|
|
{"chat_id":"5aa10886-61e0-47f2-82d2-c09a05bbd45f","concurrency":20,"successful_reads":20,"latency_ms":{"p50":111.620,"p95":113.364,"max":113.603},"sql_page_loads":20}
|
|
|
|
After: CACHE_STAMPEDE_PROTECTION=true
|
|
{"chat_id":"96fd0c67-907f-4681-8ec5-6fcbfc4d8fc7","concurrency":20,"successful_reads":20,"latency_ms":{"p50":157.831,"p95":159.477,"max":159.549},"sql_page_loads":1}
|
|
|
|
Reduction: (20 - 1) / 20 * 100 = 95%.
|
|
|
|
Cache restart:
|
|
Command: python3 student-tests/cache_recovery.py
|
|
PASS: history remains correct after Redis restart
|
|
|
|
Read-after-write:
|
|
Command: python3 student-tests/lab4_checks.py
|
|
PASS: registration race, chat rollback and cache read-after-write
|