Make datastore that handle many request at the same time without overlap/overwrite anything

To simply things out. I need a datastore that handle many request at the same time (including different server save) without overwrite or overlap anything that saves before. Everyone recommend Updateasync() i think it uses to compare data. Any help is appreciated

But the request comes from multiple server. im scared that the data got overlap like for example

Original Data {Uid1,Uid2}

Client1 {Uid1,Uid2,Uid3} Uid3 is client1 uid here
Client2 {Uid1,Uid2,Uid3} Uid3 is client2 uid here

The clients here save the data at the same time so the data on Client1 will Overwritten by Client2
Hopes this makes a image how my problem was, and sorry for grammar

I have a few questions to ask:

  • If two servers are writing to the same data at the same time, how do you determine which one should save?
  • How many requests do you need to handle?
  • What is this for? Can you provide more context?

answering the question:

  • thats the problem, i cannot determine which one should i prioritize to save
  • For now my game doesnt have many players online or new player joining so maybe 10-30 request/minutes
  • Im planing to make datstore that stores all player userid that has joined the game before. Im making rewarding system, like mail

Sorry for verry late reply, i do have work to do

If you are only saving a player’s data to their key when they are in a server, you will not have this issue. If the character tee is online, you could check with server messaging service. (Assuming you are sending messages to player and saving them)

i mean, you can think about globaldatastore. Storing player userid that has been joined before

DataStores can only handle so many requests, in total you can handle about: 60 + (Players x 10) a minute (using GetAsync / SetAsync)
which if you have 1 player in the game, it would equate to about 70 requests.

The Best thing you could do is Handle the Data efficiently while sending little to no requests, Sending multiple requests at a time isnt good practice.

profileservice datastore seems like a good option

nice information, but the request comes from multiple server. im affraid that the data got overlap like for example

Original Data {Uid1,Uid2}

Client1 {Uid1,Uid2,Uid3} Uid3 is client1 uid here
Client2 {Uid1,Uid2,Uid3} Uid3 is client2 uid here

The clients here save the data at the same time so the data on Client1 will Overwritten by Client2
Hopes this makes a image how my problem was, and sorry for grammar

i agree with you, but i dont really know how to use profile service even from tutorials

ProfileService is a Regular DataStore that handles Data efficiently, there is nothing more to it, the OP is trying to make their own system that can be efficient by itself.

The Data should not overlap in Different Clients, unless you are doing something seriously wrong with your DataStore

is UpdateAsync() will not overlap the data currently saving and saved before? i’ll try experimenting then

All UpdateAsync does is read the Data you give it and Saves it, the function is used to compare the old Data (that data that is currently saved under that key) to the new Data (the one you are trying to save), and to Save the Data you give it, but if you still continue to save the Data while they are on the Different Server, Maybe it will overwrite the data while they are in the game? But that is where you can probably check if the Player is actually within the Server or not to save it. And When they are in the game, it should not affect their data while playing, if you set it up correctly.

i think caching is the best way, but unfortunately im not a pro programmer