Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I am WAY below the datastore request limit, but my requests are still going on queue?

I have a 50 player game and I've set it up to do one GetAsync() when a player joins, and one SetAsync() when a player leaves.

On the wiki, it says the datastore request limit resets every minute, and on a 50 player server, that would mean I'm allowed to have 560 datastore requests per minute.

I've set a "print" command to tell me when the server is sending requests, and according to the server output, only about 5-10 requests are happening per minute on my server.

However, I'm getting a bunch of warning telling me the requests are going on queue, why? I'm only sending 5-10 a minute, and I have a maximum of sending 560 a minute. Why are they going on queue? (Someone with datastore experience explain?)

EDIT: IM NOT TESTING IN STUDIO. I'm testing IN-GAME on ACTIVE servers with real players. There are 50 players online. I am looking at the F9 window for the Server Logs. I set up a print command to tell me every time players are getting their save or saving. Looking at the actual log, it's telling me that im having 5-10 saves/getsaves per minute. Thats why I am confused why its queueing the requests.

Players are actively telling me they are losing their saves.

8 comments

0

Im not answering your question but asking one, is it 560 RPM for a 50 player server, or a server with 50 players?

0

It's a server with 50 players in it, and I did the math from the wiki for RPM, which would be 560 (for me)

0

The Studio data limit is far below the actual data limit, so it will fill up much faster than the actual in-game limit.

0

I am testing the in-Game limit. I'm going on active games with 50 people online, and these queues are happening.

0

Im doubtful i can help but maybe post your script so others can see if maybe you've missed something.

0

Okay, I'll do that, thank you

0

Just out of curiousity what kind of game do you have where you require 50 person servers?

0

I don't require 50 person servers, but its an RP game with a large world, and 50 person servers just make it more interactive

1 answer

Giving my DataStoreScript because of Dinoz's request:

This is what I wrote to get a player's save when they join and save it when they leave (And an extra one for emergencies for if the game crashes/shuts down)

There are pcalls that catch errors, but so far in the F9 menu, i have seen no errors happen. (Ive been online for about 2 hours monitoring)

Edit: My server log shows about 5-10 ("Saved data for "..player.Name)'s and ("Successfully got of saved data for "..player.Name)'s per minute. I wish I could post images of what it looks like.

local PlayerSavedData = game:GetService('DataStoreService'):GetDataStore("PLAYERSAVEFILE")
local RunService = game:GetService("RunService")

local moneygain = 60 
local errordebounce = 5

game.Players.PlayerAdded:connect(function(player)
	repeat wait() until script:FindFirstChild("PlayerSave")
	local save = script.PlayerSave:Clone()
	save.Parent = player
	local amount = save:WaitForChild("Amount")
	while wait(moneygain) do
		amount.Value = amount.Value+5
	end
end)

function BirdsDataTable(player)
    local BirdInventory = {
		Amount = player.PlayerSave.Amount.Value,
        Peafowl = player.PlayerSave.Peafowl.Value,
        Parrot = player.PlayerSave.Parrot.Value
    }
	return BirdInventory
end

function SaveData(player)
	local Success,Error = pcall(function()
		local playerkey = "player-"..player.userId
		local data = BirdsDataTable(player)
		PlayerSavedData:SetAsync(playerkey,data)
		print("Saved data for "..player.Name)
	end)
	if Error then
		print("***ERROR SAVING DATA FOR "..player.Name)
		local attempts = 0
		while wait (errordebounce) do
			local retries = attempts + 1
			attempts = retries
			local pass,fail = pcall(function()
				local playerkey = "player-"..player.userId
				local data = BirdsDataTable(player)
				PlayerSavedData:SetAsync(playerkey,data)
				print("Successfully saved data for "..player.Name)
			end)
			if pass or attempts == 10 then break end
		end
	end
end

game.Players.PlayerAdded:connect(function(player) --fires GetAsync when the player joins
	repeat wait() until player.Character
	repeat wait() until player:FindFirstChild("PlayerSave")
	local PS = player.PlayerSave
	local data = BirdsDataTable(player)
	local playerkey = "player-"..player.userId
	local Passed, Error = pcall(function() 
		local SaveFiles = PlayerSavedData:GetAsync(playerkey)
			if SaveFiles == nil then
				print(player.Name.." has no save data yet")
			else
				PS.Amount.Value = SaveFiles.Amount
				PS.Peafowl.Value = SaveFiles.Peafowl
				PS.Parrot.Value = SaveFiles.Parrot
				print("Got saved data for "..player.Name)
			end
		end)
	if Error then
		print("***ERROR GETTING SAVE FILE FOR "..player.Name)
		local attempts = 0
		while wait(errordebounce) do
			local retries = attempts + 1
			attempts = retries
			local pass,err = pcall(function()
				local SaveFiles = PlayerSavedData:GetAsync(playerkey)
					if SaveFiles == nil then
						print(player.Name.." has no save data yet")
					else
						PS.Amount.Value = SaveFiles.Amount
						PS.Peafowl.Value = SaveFiles.Peafowl
						PS.Parrot.Value = SaveFiles.Parrot
						print("Successfully got of saved data for "..player.Name)
					end
			end)
			if pass or attempts == 10 then break end
		end
	end
end)

game.Players.PlayerRemoving:Connect(SaveData) --fires SetAsync when the player leaves

game:BindToClose(function() --only fires of the game closes unexpectedly
	if RunService:IsStudio() then return end
	local Players = game:GetService("Players")
	for _,player in pairs(Players:GetPlayers()) do
		SaveData(player)
		print("Saved data for "..player.Name.." on shutdown.")
	end
end)

5 comments

0

SOLUTION FOUND: The admin command script that I've downloaded into my game was causing all of this. It automatically saves logs often. I figured this out because the queue request keys weren't matching to any keys in any of my code. How do I get the admin commands to not save the logs? I don't really need them. Should I just remove the admin command model and make my own?

0

Id go with option 2, remove the admin command script and worry about making your own later, i cant see the gain being worth the cost here.

0

You're right, thanks! The model i was using was Kolh's, but i dont want it's log save feature (that i really dont need) to throttle people's saves.

0

You may try a few others, Adonis is supposedly good. At least you know now that theres a potential conflict.

0

I wish there was a way for me to simply turn off the log saves for Kolhs, since Kohls is useful for kicks/bans and other useful things

This discussion is preserved as it was. New answers, comments, and votes are closed.