I am experiencing significant delays in DataStore requests during the first 40 seconds of server startup. In my analytics, I have observed that while most DataStore requests typically complete in around 0.2 seconds, all requests that take longer than 10 seconds occur exclusively within this initial server startup period. Some requests are delayed by as much as 30+ seconds.
Expected behavior
I expect DataStore request times to remain consistent regardless of how long the server has been running.
Does it happen to all requests or only read or write requests? It is possible that the quota is exceeded and the requests get queued. Can you check the return value of GetRequestBudgetForRequestType at start up?
More information: I accidentally left in some code that kicked players if part of the loading screen took more than 20 seconds to load. Turns out, sometimes (and in new servers especially), that DataStore request can take significantly longer than that, and lots of people got kicked. That being said, due to loading the leaderboards some requests could have been throttled!
I don’t have time to collect data on this properly right now unfortunately.
The only long loads for the past 5 days have only been after the server was open for 10+ hours. (This might be a different issue?)
The issue stopped when we stopped preloading animations on the server. What we were doing was this:
local function preloadAllAnimations()
local model = Instance.new("Model")
model.Name = "PreloadedAnimations"
model.Parent = Workspace
local animationController = Instance.new("AnimationController")
animationController.Parent = model
local animator = Instance.new("Animator")
animator.Parent = animationController
-- This loops through every animation in our game. We have a lot and they are big.
for _, data in require(ReplicatedStorage.AnimDB) do
local animation = Instance.new("Animation")
animation.AnimationId = data.animId
animator:LoadAnimation(animation)
end
end