Design a real-time Gaming Leaderboard.

Code Playground
JavaScript (V8)
Loading...
Console Output
// Output will appear here...
// For React: ReactDOM.createRoot(rootElement).render(<App />);
Recommended Answer

System Design Scenario:

1. Requirements: Real-time rank updates, top 10 players, specific user rank.

2. Data Structure: Redis Sorted Sets (ZSET).

* ZADD leaderboard

3. Operations:

* Get Top 10: ZREVRANGE leaderboard 0 9

* Get User Rank: ZREVRANK leaderboard

4. Scaling: Sharding based on game ID or region if dataset is too large for single Redis instance.