📊 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

ColumnDescriptionTarget
ResourceName of the running resource
Time (ms)CPU time per frame< 2.5ms for heavy resources, < 0.5ms ideal
+Time (ms)CPU spikesWatch for > 6ms spikes
Mem (KB)Current memory usage< 102400KB (100MB)
CPU %Average CPU shareKeep below 1.5%
StateRunning / pausedEnsure 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

  1. Baseline: Enable resmon 1 on an empty server and screenshot the metrics.
  2. Load test: Spawn typical player traffic or run automated scenarios.
  3. Collect: Use resmon profile 120 to capture two minutes of data.
  4. Analyze: Open resmon.json in a spreadsheet, sort by avg_time or peak_time.
  5. 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

SymptomInvestigationResolution
qb-inventory > 2msReview animation loopsReduce Wait times, debounce UI updates
Memory climbing steadilyCheck for spawned objectsClean up entities, remove leaked references
Spikes after restartCompare to baselineDisable new resources and reintroduce one by one
Network spikesInspect websocket/NUI trafficCompress payloads, lower update frequency

Pair resmon with other tools

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