Core dataGaming

Real-Time Leaderboards

Live rankings for games, sports and social apps, with score updates and reads running in parallel.

sorted on write
Always
command for the top 10
1
command for a player's rank
1
Step 1 of 5
Record a score

A match ends and the result is written.

Example sessionplaying
# Record a score
hotkv> ZADD board:2026-w42 1500 alice
(integer) 1

An animated walkthrough with real HotKV commands and example replies. Click any step to jump to it.

The problem

A leaderboard is written constantly and read constantly. Every score change can reorder the table and every player expects to see their rank right away. Recomputing rankings in a relational database does not hold up once traffic grows.

How HotKV handles it

Sorted sets keep members ordered by score as they are written, so the top of the table and any player's rank are always ready to read. HotKV executes commands on many worker threads, so score updates and reads are not funnelled through one thread.

Step by step

What happens, command by command

  1. 01

    Record a score

    A match ends and the result is written.

    ZADD board:2026-w42 1500 alice
  2. 02

    Add to a score

    Bob wins a round. His score grows and the order updates at once.

    ZINCRBY board:2026-w42 250 bob
  3. 03

    Show the top 10

    Every client and the stream overlay read the leaders while writes continue.

    ZREVRANGE board:2026-w42 0 9 WITHSCORES
  4. 04

    Where do I stand?

    Each player sees their own position.

    ZREVRANK board:2026-w42 alice
  5. 05

    Weekly reset without a job

    Each week has its own key and expires after two weeks.

    EXPIRE board:2026-w42 1209600
Where it fits

Real-world scenarios

Mobile and console games

Global, regional and friends-only boards are separate sorted sets, updated after every match.

Fitness and learning apps

Weekly streak and points rankings reset themselves by switching to a new key each week.

Live events and esports

Broadcast overlays read the standings every second while results stream in.

Built in

What you get

Always-ordered rankings

No ranking job to run. The order is maintained as scores arrive.

ZADDZINCRBY

Top lists and player rank

One command each.

ZREVRANGEZREVRANK

Many worker threads

Score updates and reads are spread across worker threads instead of one.

Periodic boards

One key per period with an expiry.

EXPIRE

Common questions

How do I build a daily or weekly leaderboard?

Use one sorted set per period, such as board:2026-w42, and set an expiry on it.

Can I combine boards?

Yes. ZUNIONSTORE adds several boards into one, for example a monthly board from four weekly ones.

Will heavy writes slow down reads?

HotKV runs commands on multiple worker threads, so score updates and reads are not forced through one thread.

Related use cases

Try it on your own workload

HotKV speaks the Redis protocol, so you can point an existing client at it and run these same commands.