Never UPDATE posts SET views = views + 1 per event on a hot post — that one row becomes a lock bottleneck. Increment in Redis, batch-flush to the DB every few seconds, and read the count from Redis. The DB stores durable totals, not live traffic.
Architecture
Client tap ─▶ API ─▶ Redis INCR views:{post} (live, source of truth for reads)
│ └── dedup: SADD seen:{post} {user/ip}
▼
every ~5s / N ops
Flusher ─▶ UPDATE posts SET views = views + delta (durable)
▲
read path: GET Redis (fallback DB on miss)
