
The Resource Monitor
The single most important debugging tool: resmon (resource monitor). Access it in-game as admin or in the server console:
resmon start
This displays a sorted list of resources by CPU usage in milliseconds. The top offenders are your optimisation targets.
What the numbers mean:
- < 0.1ms: Idle, not a problem
- 0.1 - 1ms: Normal for complex resources
- 1 - 5ms: Monitor these; may become problems at scale
- > 5ms per resource: Active performance problem
Common Resource Drains
Minimap/HUD resources - Some HUD resources run heavy Citizen.CreateThread loops drawing NativeUI elements every frame. Look for these in the top of resmon.
Vehicle spawner scripts - Spawning many vehicles with complex management logic is expensive. Check vehrespawn-type resources.
Dispatch/emergency systems - Scripts polling player positions every 500ms for 64 players = 128 database queries per second.
Chat systems - Complex chat moderation systems with regex processing on every message can be surprisingly expensive at scale.
The Polling Pattern Problem
Most script inefficiency comes from unnecessary polling:
-- EXPENSIVE: checks every 500ms per player
Citizen.CreateThread(function()
while true do
for _, player in ipairs(GetActivePlayers()) do
-- check something for this player
end
Wait(500)
end
end)
-- BETTER: event-driven where possible
AddEventHandler('playerConnecting', function(name, setKickReason, deferrals)
-- handle on event, not on poll
end)
Resource Count Management
More is not better. A server with 200 resources where 50 are dormant or duplicate functionality wastes memory and start-up time.
Conduct a quarterly resource audit:
- List all resources
- Identify which gameplay features each provides
- Remove any with no clear gameplay function or duplicating another resource's function
- Test server start-up time before and after (fewer resources = faster cold start)
The leanest RP servers are the fastest.