📊 Resmon Basics
resmon
is FiveM’s built-in resource monitor. It helps you profile CPU time, memory usage, and network activity so you can spot expensive scripts before they impact players. Use this guide as your quick reference while optimizing resources.
When to use resmon
- After installing a new resource or update
- Before large events or content drops
- During player reports of lag or desync
- As part of weekly maintenance to track regressions
Essential commands
resmon 1 # Enable real-time overlay in F8 console
resmon 0 # Disable overlay
resmon_save # Write current snapshot to resmon.json
resmon profile 60 # Record 60 seconds of detailed metrics
You can run these commands from the server console or a client with the appropriate ACL permissions (command.resmon
). Add this to server.cfg
for admin access:
add_ace group.admin command.resmon allow
add_principal identifier.steam:110000112345678 group.admin
Understanding the metrics
Column | Description | Target |
---|---|---|
Resource | Name of the running resource | — |
Time (ms) | CPU time per frame | < 2.5ms for heavy resources, < 0.5ms ideal |
+Time (ms) | CPU spikes | Watch for > 6ms spikes |
Mem (KB) | Current memory usage | < 102400KB (100MB) |
CPU % | Average CPU share | Keep below 1.5% |
State | Running / paused | Ensure critical resources stay running |
ℹ️
High time or memory in one resource affects the entire server tick. Always compare results against a clean server baseline.
Profiling workflow
- Baseline: Enable
resmon 1
on an empty server and screenshot the metrics. - Load test: Spawn typical player traffic or run automated scenarios.
- Collect: Use
resmon profile 120
to capture two minutes of data. - Analyze: Open
resmon.json
in a spreadsheet, sort byavg_time
orpeak_time
. - Act: Refactor loops, batch database calls, or offload heavy work to the server.
Automating snapshots
CreateThread(function()
while true do
Wait(900000) -- 15 minutes
ExecuteCommand('resmon_save')
TriggerEvent('qb-log:server:CreateLog', 'monitoring', 'Resmon Snapshot', 'green', 'Saved resmon snapshot for trend analysis')
end
end)
Store snapshots in version control or object storage. Track metrics over time to catch slow regressions before they become outages.
Common issues and fixes
Symptom | Investigation | Resolution |
---|---|---|
qb-inventory > 2ms | Review animation loops | Reduce Wait times, debounce UI updates |
Memory climbing steadily | Check for spawned objects | Clean up entities, remove leaked references |
Spikes after restart | Compare to baseline | Disable new resources and reintroduce one by one |
Network spikes | Inspect websocket/NUI traffic | Compress payloads, lower update frequency |
Pair resmon with other tools
- Server Optimization – tune OS and server.cfg
- Safe Server Events – prevent malicious event spam that can skew metrics
- Troubleshooting Database – resolve slow SQL queries that trigger frame drops
Quick checklist
- Enable
resmon 1
during QA sessions - Capture
resmon_save
snapshots before and after deployments - Track top 5 CPU-heavy resources in a shared dashboard
- Set alerts if any resource exceeds 3ms for more than 5 minutes
- Review resmon data during weekly ops meetings