Code: 6, Error: The rate of requests exceeds the allowed limit (Memory Store)

Reproduction Steps

I have a coroutine inside a RunService.Heartbeat that saves the online status for the players in a Memory Store ONCE A SECOND:

local function UpdatePlayers()
	local Success, Errormessage = pcall(function()
		MemoryStore:UpdateAsync('Players', 
			function(Players)
				if not Players then Players = {} end
				-- some processing...
				return Players
			end, 
			60*60*24 -- 24 hours
		)
	end)
end

Cont1Second += Delta
if Cont1Second > 1 then
	Cont1Second = 0
	coroutine.wrap(function() -- avoid yield
		UpdatePlayers('UpdatePlayers')
	end)()
end

This works fine, but SOMETIMES I get this warning:



Expected Behavior

Memory Store says:



Actual Behavior

Although I’m still in testing and this is happening inside the Studio, I believe it’s a problem in the Engine, so I open a report here.
The problem occurs RANDOMLY without any apparent reason.

Issue Area: Engine
Issue Type: Connectivity
Impact: Low
Frequency: Sometimes

1 Like

The API documentation itself is kinda confusing, but it mainly says that you have 100k requests per minute for the entire game, not per server as a lot of people think it is.

For sure there is a limit on how many requests you can do on a server per minute. I recommend you use the APIs just like if it were a data store.

If you do SetAsync using data stores multiple times in a short time span you will for sure run into issues. The same happens with MemoryStoreService and according to what I understood from your post, you are overriding something in MemoryStoreService every second.


Correct me in case I understood your post wrong.

2 Likes

As you can read in the OP, I’m using UpdateAsync and only 1 request per second, as I’m testing for now with only one player.

1 Like

UpdateAsync will use one read request and a write request as well (because it gets and sets), calling it every second will cause issues. It doesn’t matter if is one player, you are getting and setting multiple times in a row just one Key, in this case, “Players”.

Maybe try making the request every 10 seconds instead of 1. I can agree with you that the error shows up whenever it wants though since I made 73 requests and it errored, then it did 100+ and no errors.

Actually wouldn’t it be a max of 1100? I’m looking at this bit here
image
I don’t know if I can read or not though

Also I’m multiplying by 2 because you have a read AND write request in one update.

The documentation is confusing as I said, read the following line:

You can see the 100k is under the experience level and not server, in other words, you do not have 100k request per minute on a server, it would be crazy as you could literally just send like 5k requests in less than a minute.

Roblox also literally forgot to add to the documentation how many requests per minute you can do in a server I believe.

Yes 1100 is infact greater than 60. typo
On a serious note though it could be that other scripts are being put into this same queue/sorted map, I have no idea though I’m not a verified API expert.

There’s also this bit at the bottom that states there is a “very limited quota in studio similar to an experience”


I will just leave it here, I just don’t recommend you do 1 request per second all the time.


By the way, I found a similar issue reported with Messaging Service in 2019 PublishAsync with MessagingService gone wrong! - Help and Feedback / Scripting Support - DevForum | Roblox. It kinda has the same error, so maybe is a Roblox bug not sure.


When I use Memory Store in my game, I just make the least amount of requests possible since I don’t want to mess with Roblox’s limits. Your game has maybe a different structure though and you need to get accurate data from other servers via Memory Store, though I believe at least 5-10 seconds would be fine (if the issue persists, then consider it a bug). You are also using UpdateAsync which Reads and Gets on the same key, I am not sure if Roblox divides the limits between Reads and Gets for memory store as they do for data stores.

Something worth noting here is that just because you could, doesn’t mean you should.

Unless you have some very specific reason to be interacting with a memory store every second (which can likely be replaced with something that doesn’t do that) there’s no reason to be hammering Roblox’s services like this.

If you’re saving the online status for players, have you considered only saving their status any time you want to update it? (eg setting them to online when they join a game, setting them to offline when they leave, maybe giving an extra check every 2-5 minutes if you wanna have a failsafe) That way you won’t be feeding Roblox pointless data saying the same thing every single second.

3 Likes

It’s not just the status, it’s a lot of data that needs to be available for the entire game, even if the players are distributed among several servers, such as the time remaining for a certain player’s activity to finish (countdown) among other things that can be tracked online among other players on other servers.
Of course, I know I can increase the time between requests, but that’s not the problem.

First I need to know: what does Code: 6 means?
This is not documented anywhere.

This could be incorrect, on datastores UpdateAsync causes two requests to be made, so this could be the same with MemoryStoreService. Also, are you sure this isn’t an issue of the key exceeding the maximum size of 32kb?

Even if that were the case, it would still only be 120 requests per minute and not 1100.

It doesn’t even reach 100 bytes.

Still the question:

@TestyLike3 here has the solution in the image, I think people skimmed over it.

Also @rogeriodec_games just FYI I think you are confusing people by constantly highlighting the “100,000”, this doesn’t apply because you’re not testing with 1000 player windows in Studio so hence all the follow-up replies you’re getting here.

OP should probably do two things:

  • File a documentation request to have the Studio limits documented.
  • Post a feature request with use cases on why current Studio limit for Memory Stores is not sufficient and should be increased.
1 Like

I think people skimmed over it this:

As I said, the problem occurs randomly and, at least for now, in the testing phase in Studio.
And, as I said, I’m only using 1 user for now and that’s no more than 60 (or 120) requests per minute, with a small number of bytes per request.

As the error code is not clear, it is not possible to know where the problem really is and therefore I worry when the game enters the production phase.

But I will follow your suggestion and add a documentation request.

3 Likes

The documentation you linked says at the very bottom: Studio Testing: The quota you have for Studio will be very limited similar to the minimum quota of an experience. The exact Studio limitations are not provided in the documentation, this may be an oversight.

Also: It is not good practice to submit a UpdateAsync() every second, even if you can do it with the current limits you won’t be able to scale it at 100,000 players ( thus 100,000 per-minute at the experience level ) and as others have pointed out in this thread, that API counts as 2 per-call ( one for write, one for read )

The code example you provided is running a new coroutine every 1 second, this means a new thread is being spawned every second and if Roblox DataStore APIs slow down for any reason you could be seeing multiple UpdateAsync() running at the same time when those threads all finish at once. This may be why it’s happening “sometimes”

If you prefer to update data stores every second, try removing the Coroutine and update every 1 second after a successful UpdateAsync()

4 Likes

Hi All,
We believe we have fixed this Memory Stores quota issue and also updated documentation. Please reopen or create a new bug ticket if you are experiencing unexpected Memory Store quota issues.

2 Likes