Load math and the materialization decision
2M orders/day: rates, fan-out, and the break-even rule
teaching numbers: avg 23.1/s, peak 231.5/s, 3 notifications per order
rates per second (bars illustrative, values labelled)
avg orders 23.1/s
peak orders 231.5/s (10x)
avg notifications 69.4/s
peak notifications 694.4/s
payload approx 1 KB: peak approx 0.7 MB/s, one queue is enough
the view you define
1 order in, k writes out
example: k = 4 (2 regions x 2 replicas)
payload approx 1 KB, lag budget stated
3 notifications are NOT 3 cache writes
peak extra writes: 4 x 231.5 = 926/s
break-even: materialize iff reads/s x saved-read value is greater than orders/s x k x write cost
wins: 5000 reads/s saving an 8 ms DB read each vs 926 extra writes/s
loses: 5 reads/s vs the same 926 writes/s, serve read-through with short TTL
legend: blue bars = order rates, green bars = notification fan-out, peach = your view, yellow = decision rule