Test your server under load to identify performance issues before they affect players.
Spawning synthetic peds simulates player load on the server’s entity management system. This helps test sync bandwidth and client-side performance in crowded areas.
RegisterCommand('testload:peds', function(source, args)
local count = tonumber(args[1]) or 50
local model = `a_m_y_skater_01`
local peds = {}
RequestModel(model)
while not HasModelLoaded(model) do Wait(0) end
local playerPed = PlayerPedId()
local coords = GetEntityCoords(playerPed)
for i = 1, count do
-- Random offset within 20 units
local x = coords.x + math.random(-20, 20)
local y = coords.y + math.random(-20, 20)
local ped = CreatePed(4, model, x, y, coords.z, 0.0, true, true)
-- Make them wander to simulate activity
TaskWanderStandard(ped, 10.0, 10)
table.insert(peds, ped)
end
print(('Spawned %d test peds'):format(count))
end, true)Test vehicle synchronization and physics load. Large amounts of vehicles can heavily impact server-side physics calculations and client FPS.
RegisterCommand('testload:vehicles', function(source, args)
local count = tonumber(args[1]) or 30
local model = `blista`
RequestModel(model)
while not HasModelLoaded(model) do Wait(0) end
local playerPed = PlayerPedId()
local coords = GetEntityCoords(playerPed)
for i = 1, count do
local x = coords.x + math.random(-30, 30)
local y = coords.y + math.random(-30, 30)
CreateVehicle(model, x, y, coords.z, 0.0, true, true)
end
end, true)Press Ctrl + Alt + R (or type resmon 1 in F8) to open the Resource Monitor.
Use the built-in profiler to find bottlenecks in specific functions.
profiler record 500 (records 500 frames).profiler view to open the analysis in Chrome.For deep server-side analysis on Windows host machines, use ETW traces to see system-level calls (disk I/O, network stack).
Simulate a car meet or robbery.
Spam database save events to check for I/O blocking.
-- CAUTION: Run only on dev DB
RegisterCommand('test:dbsave', function()
print("Starting DB stress test...")
for i=1, 100 do
MySQL.insert('INSERT INTO logs (message) VALUES (?)', {'Test log ' .. i})
end
print("DB stress test queued.")
end)