सबै traffic एउटा key मा खन्याउन बन्द गर्नुहोस्: hot key लाई N sub-key (sharded counter) मा विभाजन गर्नुहोस्, duplicate read coalesce गर्नुहोस्, local cache बाट serve गर्नुहोस्, र write batch गर्नुहोस् ताकि एउटा row हरेक request मा update नहोस्। viral post मा एउटै "likes" counter ले 50k write/sec लिन सक्छ — एउटा row serialization bottleneck बन्छ किनकि हरेक transaction एउटै lock का लागि लड्छ।
एउटा contended row को सट्टा fan-out
50k inc/sec on post:123
│
hash(request) % N (split the key)
┌────────┬────────┬────────┬────────┐
▼ ▼ ▼ ▼ ▼
likes:123:0 :123:1 :123:2 :123:3 :123:4 ← sharded counters
└────────┴───┬────┴────────┴────────┘
▼
SUM on read = total (read fans in)
