BIENVENUE10valid for the first month only! on all offersView plans
Skip to content
← Knowledge base

FiveM: latency and hitching (optimization)

Reduce server lag by optimizing the tick rate, OneSync and resource-heavy scripts.

FiveM: latency and hitching (optimization)

A smooth FiveM server keeps a stable tick rate above 30 Hz. Hitching and latency appear when a resource blocks the main thread or the network saturates.

Cause / The problem

The “server thread hitch warning” messages indicate that a script takes too long to run on a single cycle (tick). Common causes: loops that are too heavy, synchronous SQL queries in the main thread, too many synchronized entities, or an undersized OneSync configuration.

Solution

  1. Identify the slow resources. In the txAdmin console, the “Hitch time: XXXms” warnings are often followed by the name of the offending script. Also use the profile command to generate a per-resource CPU report.
  2. Optimize SQL queries. Replace MySQL.Sync.fetchAll calls (blocking) with MySQL.Async.fetchAll. Add indexes on frequently filtered columns (identifier, citizenid).
  3. Reduce network load. Check sv_maxclients: a 128-slot server with 30 players does not need to be configured at 128. Lower it to 64 if that is your real peak.
  4. Limit your resources. Beyond 150 active resources, startup and tick performance degrade. Disable what you do not use (stop in the console, comment out the ensure).
  5. Enable OneSync Infinity (onesync on) for better network load distribution than in legacy mode.
  6. Monitor the tick rate via the sr_maxSnapshots command or a txAdmin dashboard: a healthy server stays above 30 Hz, ideally 60 Hz.

Aim for a server FPS above 30 on average. Below that, players feel the lag even with a good ping.

Related products

oneSubnet

French hosting provider in Paris. High-performance game and voice servers.

SERVICES

Resources

LEGAL

All systems operational