Design a real-time ranking system for scores or points. Users submit score updates; clients read top-N ranks and a user's surrounding rank. The system should handle frequent updates and high read volume on hot leaderboards.
Functional requirements
- Submit or increment scores for a user in a named leaderboard
- Query top N players with scores and ranks
- Look up a user's rank and neighbors (above/below)
- Reset or season rollover for time-bounded competitions (optional)
Non-functional requirements
- Low latency reads for top-N on hot boards
- High write throughput for score updates with acceptable staleness rules
- Horizontal scaling of read paths via replicas or cache