Is it possible to create Global Datastore using Profile-Service?

If I use “ForceLoad” will it be bad? like if there will be idk like 10 servers with players? also idk how to use MessagingService for this

If you’re expecting that much changes,

Then yes. It’s a bad idea.

It’s also a bad idea to use MessagingService in you case.

Consider MemoryStoreService instead, which is faster to access across servers, and has more forgiving limits.

and I dont know how to use MemoryStoreService either.

Also I want to know how it’ll be bad, like lag or something

I will make it like

  1. Every 1-10 minutes, server will update amount of things exists in ReplicatedStorage (For client to access them, I can make it through remote function but it gonna be bad I think)

  2. When Client gets X it updates its amount on global datastore but not server because it updates automatically every 1-10 minutes. And to change global Profile I need for it to not be locked since cuz of that I will not be able to get it and change its data

Bypassing a session lock is not just slow, it runs the risk of hitting a datastore limit.

Do it often enough, and you might end up having a Profile straightup error, which is the worst thing that can happen to a Profile.

You should probably forget about using Profiles in your case, because this was not what ProfileService is meant for.

Resources to get you started on MemoryStoreService:

Memory store is like datastores but for cross-server?

If so would i be able to make global lobby system (Just asking, if I would be able I dont think I would make it since I still don’t know how these works)
Also I found this: Memory Store Service tutorial

MemoryStores and DataStores function about the same; the key differences are:

  • MemoryStores data have a shelf life - they’ll expire after some time (think days).
  • MemoryStores are faster to access and write to.
  • MemoryStores also have higher limits.

Please read that tutorial, and the page I linked you to earlier. It should explain your problem enough.

  • MemoryStores data have a shelf life - they’ll expire after some time (think days).

How to store amount of item existing in game then if it’ll expire after few days, Or I dont understand something

You can have a server be in charge of autosaving the data within the MemoryStore into a DataStore.

so I can save data in datastore and then share it through servers with memory store?

More or less, yes.

The idea here is that whenever that data is required, it is immediately pulled from the MemoryStore that is holding that data.
Same goes for saving changes - you save it into that MemoryStore.

Once in a while, a server will “commit”/save that data into a DataStore.
If a server starts up and finds that that data doesn’t exist in a MemoryStore (meaning it’s expired), it’ll turn to the DataStore instead.

Think of the datastore as a backup for your data, if you will.

Also, MemoryStore data refreshes when it is overwritten, and the maximum shelf life for them is 45 days.

Plenty of time and leeway to do your things, I believe.

1 Like

The data goes first to memory store (And being changed in it), then backups time by time into a datastore, and if there’s no current data in memory store, take it from datastore and put in memory store, repeat?

1 Like

Yes, that’s the idea.

The MemoryStore is for your game purposes - the DataStore is there as your backup.

If your game is big enough though, a data expiry will probably never happen, but it’s just a contingency.

Data in MemoryStore will expire only if it haven’t been changed for the time you put in?
I asked it because of this

If your game is big enough though, a data expiry will probably never happen

I mentioned this in another reply:

Also, MemoryStore data refreshes when it is overwritten…

Please read the tutorial if you still have questions.

ok so if I overwrite data (basically update it?), then the expiration time will update to X

If expiration date is idk 10 minutes
and I save backup every 1 minute, is it good or bad (will it lag or something)?

No, as long as you delegate the job of saving the data into a datastore to just a single server.

Also, there’s no need to set the expiry time that short, especially if you don’t have a lot of data to handle.

if I have 10 items (example) in a game
and every time player gets one I add existing amount +1 to a memory store with expiration date 30 days
and save backup probably every hour (And there like idk 5-10 servers)

Will it be bad?

No.

As I’ve said, please read the tutorial if you need the specifics for what you just asked.

I am reading through tutorial and almost ended reading it, then I will read documentation

“No” means it will not be bad?