For a long time now, I’ve been using MessagingService for my server lists. (client calls FireServer on a remote, remote retrieves servers with MessagingService, calls FireClient for the player that requested servers, and client displays the servers locally)
Now with the new MemoryStoreService, should I use it over MessagingService? Or is it not worth the trouble?
How I have the data set up is:
Server JobId/Reserved Server Code as key
Table of userIds in that server in a table as value
Are JobIds and Reserved Server Codes always the same amount of characters? (less than 128)
Would storing all the UserIds go over the value size limit?
And would updating the users table every time a player joins/leaves a good idea?
JobIds are GUIDS which are indeed always 128 bits. I’m not entirely sure about Reserved Server Codes because I’ve never used them, so I would do a bit more research just to be sure, but I would assume they are essentially the same as JobIds.
UserIds are 64 bits, or 8 bytes. The limit for sending memory is 1 KB (1000 bytes) per player, plus an additional 64 KB. I doubt you would need to worry about UserIds surpassing the limit for this use case.
MemoryStoreService has a limit of 100 requests per player every minute (or one request every 0.6 seconds), plus an additional 1000 in case of rare instances where you accidently surpass the limit.
Every time a player joins, the limits listed above are increased since there is a new player added. When a player leaves, the memory limit doesn’t decrease until 24 hours pass to prevent any issues with players leaving impacting memory limits.
My thoughts:
If you have used MessagingService for a good amount of time and have never experienced any issues, I wouldn’t bother changing it unless it ever gets deprecated. MemoryStoreService is certainly efficient, but it’s not necessarily a replacement for MessagingService and I believe it’s more of an add-on to data stores. I can’t say exactly which would be the best fit for server lists, but I don’t think it’s all that necessary to switch to a newer system if your current system has continued support and has also never caused any trouble.
I am a little bit confused by this:
the documentation states that memory size is 64KB + 1KB ⨉ [number of users]
but then also says:
Reserved Server Access Codes are about 56 characters (how much bytes is that?)
Personally the only issues I had with my current system is that sometimes no servers get displayed (probably not a service issue since NONE of them get displayed, so maybe a ping issue?)
So Im guessing its not worth switching over (at the current moment)
Thanks!
EDIT: Turns out the load time issue was just because I was getting the player icons AND checking if player is friends with that player in a single thread (which yielded)
After using task.spawn, the servers appear instantly
A standard character (letters, numbers, symbols, etc.) is 1 byte. Some unicode characters are 2 bytes, but I highly doubt Reserved Server Access Codes use unicode characters. Even if they did, it would only potentially double the size. This means the Reserved Server Codes wouldn’t ever exceed 112 bytes (but will likely be much, much closer to 56 bytes).
1KB is 1000 bytes, so either way, the JobIds/Reserved Server codes shouldn’t be an issue at all in terms of memory limits being exceeded.
EDIT: As for the screenshot, I believe the 1KB value size limit is referring to per single use, while the documentation refers to all data being held at a given time. The data will automatically expire and you can modify the expiration time through the parameters of MemoryStoreService’s functions: