Nutze ein Redis Sorted Set (ZSET), gekeyt nach Score: Rang und Top-N werden zu eingebauten O(log N)-Operationen, sodass du nie Millionen Rows pro Request sortierst. Ein ZSET hält Mitglieder automatisch nach Score geordnet; genau das ist ein Leaderboard.
Architektur
Game svc ──ZADD score──▶ Redis ZSET (sorted by score) ──ZREVRANGE 0 99──▶ Top-100 API
│
├─ ZREVRANK user ─▶ "your rank" (around-me: rank±5)
└─ AOF/RDB + async ─▶ Postgres (durable source of truth)
