[Django]-Web Leaderboard

1👍

You will appreciate the concept of sorted sets in Redis.

Don’t miss the paragraph which describes your problem 😀

👤Niloct

2👍

I’ve written a number of leaderboards libraries that would help you out there. The one that would be of immediate use is python-leaderboard, which is based on the reference implementation leaderboard ruby gem. Using Redis sorted sets, your leaderboard will be ranked in real-time and there is a specific section on the leaderboard page with respect to performance metrics for inserting a large number of members in a leaderboard at once. You can expect to rank 1 million members in around 30 seconds if you’re pipelining writes.

If you’re worried about the data changing too often in real-time, you could operate Redis in a master-slave configuration and have the leaderboards pull data from the slave, which would only poll periodically from the master.

Hope this helps!

1👍

Make a table that stores user id and user score. Just pull the leader board using

ORDER BY user_score DESC 

and join the Main table for the User name or whatever else you need.

Unless the total number of tests is a variable in your equation, the calculation from your ranking system should stay the same for each user so just update individual entries.

Leave a comment