ARCHIVED from builddistributedsystem.com on 2026-04-28 — URL: https://builddistributedsystem.com/tracks/store/tasks/task-8-2-5-read-benchmark
TASK

Implementation

Benchmark three read strategies under an 80% read / 20% write workload. Measure throughput and latency for each.

Request:  {"type": "read_benchmark", "msg_id": 1, "read_pct": 80, "write_pct": 20, "total_ops": 1000, "strategies": ["linearizable", "lease", "follower"]}
Response: {"type": "read_benchmark_ok", "in_reply_to": 1, "results": [
    {"strategy": "linearizable", "throughput_ops": 2000, "p50_ms": 5, "p99_ms": 20, "consistency": "linearizable"},
    {"strategy": "lease", "throughput_ops": 8000, "p50_ms": 1, "p99_ms": 5, "consistency": "linearizable_if_clocks_correct"},
    {"strategy": "follower", "throughput_ops": 15000, "p50_ms": 0.5, "p99_ms": 2, "consistency": "bounded_staleness"}
]}

Sample Test Cases

Benchmark all three strategiesTimeout: 5000ms
Input
{"src":"c0","dest":"n1","body":{"type":"init","msg_id":1,"node_id":"n1","node_ids":["n1","n2","n3"]}}
{"src":"c1","dest":"n1","body":{"type":"read_benchmark","msg_id":2,"read_pct":80,"write_pct":20,"total_ops":100,"strategies":["linearizable","lease","follower"]}}
Expected Output
{"src": "n1", "dest": "c0", "body": {"type": "init_ok", "in_reply_to": 1, "msg_id": 0}}

Hints

Hint 1
Test with 80% reads, 20% writes workload (common in production)
Hint 2
Compare: strict linearizable reads vs lease reads vs follower reads
Hint 3
Linearizable reads have highest latency but strongest guarantees
Hint 4
Follower reads have lowest latency but weaker guarantees
Hint 5
Measure throughput (ops/sec) and latency (p50, p99) for each strategy
OVERVIEW

Theoretical Hub

Concept overview coming soon

Key Concepts

throughput benchmarkread/write ratiolatency comparisonscalability
main.py
python
Benchmark Read Strategies Under Mixed Workload - The Store | Build Distributed Systems