Question about Datastore Limitations

For a game we have want to have a server list with several user created reserved servers. Any user can create one of these servers, and so there can be thousands at a time.

Each server has a table of server data pertaining to the server, and it is placed in a larger table of servers.

Server data is structured something like this

{
Name = "Server name here",
Description = "Server Description",
Reserved_Server = reservedserverstring
Place_ID = 11111111
Max_Players = 50
Current_Players = 36
}

My question is, is there any way to know how many tables of server data can be stored in a single key for a datastore, before reaching the Key’s limits?

You can try getting the “average” table, encode it into JSON, and divide 260,000 (the maximum amount of characters that can be stored in a datastore) by the amount of characters from the table that was encoded into JSON, and that should give you an estimation of the amount of tables you can store in the datastore

Example:

local tbl = {info here}
local res = game:GetService("HttpService"):JSONEncode(tbl)
print(2.6e5 / #res) -- 2.6e5 is just index notation for 260,000

If your game gets very popular, datastores probably couldn’t hold all of that information, even if you compress it. It’s probably best to use an external server

2 Likes