Real-time cross-server datastores?

I currently use profile service for my datastores but want to know the best way to go about saving real time cross server data without reaching the cap of saves if I were to have hundreds of full servers?

Example: I have a clan system and as people actively make clans across hundreds of servers I’d want it to check the main datastore to make sure the clan name isn’t taken and to save it in real-time to the datastore as clans are created?

I’ve never done off site data saving or anything of the sort but if there’s any way to do this in real time to make sure certain things can be saved and checked at the same time cross-server without issues that’d be great to know.

4 Likes

Since “Clan Name” is the unique identifier, I recommend using a simple datastore with the clan name as the ID. This is pretty simple, as the datastore can simply be updated using DS:UpdateAsync().

No offense but I think you missed the entire point of what I was asking, I’ve dealt with complex datastores and just happen to be using profile service for convenience as of late. The question is, how does one go about updating a set of data in real time across possibly thousands of servers with tens of thousands of players, if you were to use one datastore for this then you would near immediately reach the quota for data saving depending on how many people are attempting to do an action in game that requires updating this datastore. I want to know the best way to go about saving such things.

You could create multiple datastores and loop through each one with a pcall function and if you need to search through them you can loop through each one to check for a clan name. I have not put this into practice but i’d be careful about the requests cap.

My previous statement still stands.

You won’t reach the cap that easily if you just manage reads and writes properly. For example, you could have a system where you store server-specific changes to the data and then update them every 5 minutes.

i.e. For adding gold to the clan’s treasury, you could store a table such as this

clan.ServerGold = whatever

---------
-- Whenever you want to make a change to the gold you would update clan.ServerGold
---------

while true do
    task.wait(300)
    DataStore:UpdateAsync(clanID, function(old_data)
        old_data.gold = old_data.gold + clan.ServerGold
    end)
    clan.ServerGold = 0
end

Nvm this guy is correct if you use the clan name as the datastore key you should be able to bypass requests and change things inside of the datastore.

I see what you mean now. What if I need it instantly updated whenever the information is updated for clan creation like I was saying though? I’m just trying to make sure that 2 people can’t make a clan named the same in 2 servers at the same time.

The only time you should be doing things like that instantly is on the initial creation. Just use SetAsync if that clan ID doesn’t exist.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.