Performance10 min read

Why your FiveM server lags and how to find the cause

Server hitches, client stutter and rubber-banding have different causes. How to tell them apart, measure properly, and find the resource that is actually costing you frames.

Written by Mira Kessler

Network cables plugged into a switch

Players say 'the server lags'. That single word covers at least four different problems with four different fixes. Sorting out which one you have takes ten minutes and saves you from buying hardware you do not need.

First, separate the three kinds of lag

  • Client stutter: the player's own frame rate drops. Everyone else is fine.
  • Server hitch: the whole server pauses for a moment. Everyone feels it at the same time.
  • Network lag: movement rubber-bands, but frame rates on both ends are healthy.

Ask two questions in your Discord: did it happen to everyone at the same second, and did their own frame counter drop? Those two answers put you in the right column immediately.

Measure client cost with resmon

In the client console, resmon 1 opens a live table of every resource and the milliseconds it spends per frame. Sort by cost and watch it while you move through the world. A resource that sits at a few hundredths of a millisecond is fine. One that climbs when you open a menu, enter a vehicle or approach a busy area is your suspect.

# in the client console (F8)
resmon 1

# rough reading of the numbers
0.00 - 0.05 ms   healthy
0.05 - 0.20 ms   acceptable for an active feature
0.20 ms and up   investigate, especially when idle
Idle cost is what matters most. A script that spends 0.4 ms while its menu is open is normal. A script that spends 0.4 ms while the player is standing in a field doing nothing is broken.

Measure server cost in txAdmin

Server-side load shows up in the txAdmin performance chart and in the console as hitch warnings — a line telling you the server thread stalled for a number of milliseconds. Correlate those timestamps with what happened in game: a restart, a mass spawn, a database-heavy event. Repeating hitches at a fixed interval almost always mean a timed loop or a scheduled query.

The usual culprits

  1. Loops without a wait, or with a wait of zero, running every frame for no reason
  2. Distance checks against every player or every entity, every frame
  3. Database queries inside a loop instead of one query with a join
  4. Oversized streaming assets — textures shipped at four times the resolution anyone sees
  5. Entity spam: props, peds and vehicles spawned and never cleaned up

The pattern behind most of these is the same: work done every frame that only needs to happen when something changes. That is the difference between a script that costs nothing while idle and one that taxes every client on your server.

Fixing it without breaking the server

Change one thing at a time and measure after each change. Remove a suspect resource, restart, watch the numbers for a full evening with players on. Testing on an empty server proves nothing — most performance problems only appear under population.

If a bought resource is the cause, tell the author with numbers: the resmon reading, when it climbs, and how many players were on. A good author will take that seriously. Ours do — ask us on Discord if it is one of our scripts.

Frequently asked questions

What is a good resmon value in FiveM?
Under 0.05 ms while idle is healthy for a single resource. Brief spikes while a menu or an animation runs are normal. Constant load above 0.2 ms while nothing is happening deserves investigation.
Why does my server hitch every few minutes?
Regular hitches at a fixed interval usually come from a timed loop or a scheduled database query. Find the interval, then look for the resource that runs on it.
Will a better CPU fix server lag?
Only if the bottleneck is really CPU-bound. A faster single-core clock helps, but it cannot outrun a resource doing unnecessary work every frame. Measure first, buy second.