Find lag on your FiveM server with resmon and the profiler

Find out which resource makes your FiveM server stutter, with the hitch warnings in the console, the txAdmin chart, resmon and the profiler.

EliteStarHosting Team2 November 20264 min read

Do cars stutter, do scripts respond slowly or does your server fall behind? Often the problem is a single resource. These steps help you find which one.

1. Hitch warnings in the console

When there's a delay, the game panel's console shows lines like this one:

server thread hitch warning: timer interval of 250 milliseconds

The higher the number, the longer the server got stuck. A few of these messages while the server starts are normal: it's loading everything then. If they keep coming back while players are online, something is holding your server up. Sometimes it says sync thread or network thread instead of server thread.

2. The chart in txAdmin

Click Tx Admin at the top of your server page. The txAdmin dashboard has a chart with your server's performance next to the number of players. That tells you when things go wrong, but not which resource causes it. Read more about txAdmin in Open and use txAdmin.

The Tx Admin button at the top of your server page

3. resmon in the game

resmon is FiveM's resource monitor. It shows how much CPU time and memory each resource uses on your computer.

  1. Turn on developer mode: add +set moo 31337 to the target of your FiveM shortcut.
  2. Join your server, press F8 and type resmon true.
  3. Go to a place where it stutters and see which resources are at the top.
  4. Turn the monitor off with resmon false.

Without developer mode you get Access denied for command resmon. FiveM's Beta update channel also turns on developer mode, but it can be less stable. On FiveM for GTA V Enhanced, +set moo 31337 doesn't work: the server needs sv_devMode true there, and then only 8 players can join. So only do that on a test server.

There is no official limit. A rule of thumb many hosts use: a resource that isn't doing anything stays below about 0.1 ms. Mostly watch the resources that keep showing up at the top.

4. The profiler on the server

For the server itself there's the profiler. Type in the game panel's console while the stutter is happening:

  1. profiler record 500 records 500 frames.
  2. profiler status shows whether the recording is still running.
  3. profiler saveJSON lag.json saves the recording when it's done. The file ends up with your server files; download it from Files.
  4. Open Google Chrome, press Ctrl + Shift + I and go to Performance. Right-click in the panel and choose Load profile.

Rather not download it? Type profiler view and open the link the console gives you in Chrome.

The yellow graph, the CPU time, shows peaks. Zoom in on a peak with your scroll wheel and hover over a resource's blocks. You then see how many milliseconds it took, with the file and the lines in the code.

For low FPS on the players' side, the profiler also works in the game's F8 window.

Common causes

  • Loops with Wait(0): a script that checks something every frame, even when it doesn't need to.
  • Slow database queries: a script that sends very frequent or very large queries to the database.
  • Resources you start but don't use. Remove their ensure lines under Resources in the server.cfg editor.
  • Very large texture files (.ytd) of cars, clothing or maps. Choose lighter versions, see Add custom cars, maps and clothing.

Found the resource? Turn it off for a while and see if the lag goes away. Then look for an update or report it to its maker.