Question about Global leaderboard architecture

Hey!
I’ve been a regular here for months, but this is my first actual post.
I am developing a game where I need two main leaderboards. The basic idea is that players up/down-vote on other (famous) players, and I want to make leaderboards for most upvoted and most downvoted players.

I have searched and read a lot on OrderedDataStore and the different limits applied to datastores, and a bunch of form posts here as well, but I can’t get my head around how to best save this data.

Since players will be voting on pretty much the same UserId’s, which would be the key in a regular setup, I will hit the Experience limits (6 seconds between requests per key) pretty much instantly.

I’ve thought about saving all of it in a single key, caching it locally on each server and push changes to the DataStore every minute or so, but that would mean I would have to sort it locally later on. Not sure this is a wise path. I’m a bit lost here.

Any advice on how to think here is much appreciated :slight_smile:

Use both OrderedDataStores and normal ones, normal ones. One is used for the player’s data and the other for the player’s data.

Also I dont think you can reverse the ordered datastores to show the most downvoted player, so I suggest to make a seperate OrderedDataStore for that and just make the numbers negative when saving, so that the person with the most downvotes appears on top.

Thank you for replying!

One is used for the player’s data and the other for the player’s data.

I’m not totally sure I understand what you mean here. How would I combine them?

I can give an example of a scenario that troubles me:
Voting can happen quite quickly, and my list of people to vote on is pretty short, so lets say I get 100 votes on the same UserId in a single minute. How would I update the DataStore with those votes if there’s a 6 seconds request limit per key? :thinking:
A bit of wishful thinking to have that amount of activity, but I like to build it right from the start.

Do it like any Datastore, only update once they leave.

Doesn’t the core issue stay the same though?
If it gets popular, and 100 players leave roughly at the same time with votes on the same keys, I get 100 updates on the same key(s) with 6 seconds delay on each update.