There are several services that let servers communicate, send info, and grab info from each other. Let’s say though I want to send messages between servers as fast as possible, without a very long delay in-between. What would be the fastest way to communicate between servers?
A couple contestants are: MessagingService, MemoryStoreService, DataStoreService, etc.
MessagingService is for communicating for all servers is slow and isn’t guaranteed. Also not to mention, It’s limits will prevent you from sending alot of information from your servers.
Like take a look at these limits
imit
Maximum
Size of message
1kB
Messages sent per game server
150 + 60 * (number of players in this game server) per minute
Messages received per topic
(10 + 20 * number of servers) per minute
Messages received for entire game
(100 + 50 * number of servers) per minute
Subscriptions allowed per game server
5 + 2 * (number of players in this game server)
DataStoreService Yields to Update, Get, and Set information. Therefore I rule this out
MemoryStoreService is meant for a faster communication then DatastoreService and should be used for faster Commication. Its why you can write much more and use MemoryStore service more then DatastoreService as Datastore Service is meant for Session saving, and MemoryStore is meant for server and commucating to servers.
" MemoryStoreService is a high throughput and low latency data service that provides fast in-memory data storage accessible from all servers in a live session. Memory Stores are suitable for frequent and ephemeral data that change rapidly and don’t need to be durable, because they are faster to access and vanish when reaching the maximum lifetime. For data that need to be persistent and static across sessions, use Data Stores."
As @drewbluewasabi said- we’re gonna immediately rule out DataStoreService.
As for the absolute fastest way to send and get data, it’s MessagingService, hands-down. Messages are guaranteedalmost guaranteed to be sent and received within a second, and messages are received through a callback, which will always be faster than, say, a loop (foreshadowing moment!).
On the other hand, MemoryStoreService uses asynchronous methods, which will always have a somewhat large delay compared to other methods. It also has a high rate limit - while it looks like a lot of requests on paper, but since there is no callback involved in MemoryStoreService, with the delay between the loop you would have to use, it would run out quick.
Don’t reference this when deciding which service to use, however. Keep in mind MemoryStoreService is meant for rapidly writing and getting things like leaderboards and queues. These things would NOT use a loop, which would make it a much better option than MessagingService. However, if you’re sending small bits of information that will not be stored cross-server whatsoever, MessagingService is the way to go.
“Delivery is best effort and not guaranteed. Make sure to architect your game so delivery failures are not critical.”
I just want to correct you, As I did rely on MessagingService that I really shouldn’t because of it’s best guess attempt (In my case, a global party system, which if failed, would cause issues with joining a global party, leaving etc.).
While it’s little, roblox says that you should use it for an announcement system or global chatting. Where if a message isn’t recieved, It’s not a huge deal, and it won’t break the game.