FiveM – Fixing FPS Drops & Server Hitches
Improve Fivem performance: reduce lag, boost tick rate – optimization tips from NexoraHost.
Quick answer: Improve server performance with targeted config changes – check RAM/CPU usage, tune settings and remove heavy mods/scripts.
This guide helps you identify and fix FPS drops and server hitches on your FiveM server. A hitch means the server "hangs" for milliseconds to seconds – all players freeze briefly, vehicles jump and the gameplay experience suffers massively.
Note: More guides on performance optimization can be found in the left navigation.
Identifying Causes: Server-Side vs. Client-Side
Problem Server-Side Client-Side
All players affected simultaneously? Yes – everyone freezes at the same time No – only individual players
Main cause CPU spikes, script loops, database lags GPU overload, local mods, graphics settings
Detection Server console shows "server hitch" warnings Players report stutters, others don't
1. Identifying Server Hitches
Hitch Warnings in the Console
When the server hangs, the console shows warnings like:
Warning: server hitch of 345 ms detected Warning: server hitch of 1200 ms detected – this is severe! Anything over 100 ms is noticeable. Anything over 500 ms is critical and causes visible stutters for all players.
Finding Hitch Sources with txAdmin
- Open txAdmin → Diagnostics
- Look at the Performance Graph – red spikes are hitches
- Click on a spike to see which script caused the hitch
- txAdmin shows the exact resource and duration in ms
2. The Most Common Causes of Server Hitches
Database Queries During Gameplay
The most common reason for hitches. Every time a script makes an SQL query, the server can briefly hang – especially with unoptimized queries:
- Problem: SELECT * FROM players without LIMIT with 1000+ players
- Problem: INSERT/UPDATE in a loop (e.g. saving each item individually)
- Solution: Use LIMIT on queries, use bulk inserts, use oxmysql (asynchronous)
Bad Script Practices
- Endless loops: while true do without Wait() – blocks the entire server
- Too many Citizen.Wait(0): Each 0ms wait forces a new tick – several per frame eat CPU
- Large amounts of data in one tick: Loading 1000 player data at once instead of in portions
Streaming Assets
- Too many YDR/YTD files (models/textures) being loaded simultaneously
- Large MLOs (interiors) that briefly block the server when entered
- Solution: Unload assets with
SetModelAsNoLongerNeeded(), set stream priorities
3. Fixing Client-Side FPS Drops
Client Configuration in txAdmin
In txAdmin under Settings → Game Settings you can enforce client-side settings:
# Disable heavy graphics settings setr game_enableFlyThroughWindscreen false setr game_enableDynamicShadowCasting false setr game_enableLongDistanceShadows false setr game_enableHighQualityShadows false setr game_enableVehicleHeadlightShadows false
Client Streaming Priorities
`# Increase streaming budget (MB) setr streaming_memory 256
Adjust stream tick rate
setr streamerTickMs 20`
4. Using Profiling Tools
txAdmin Performance Graph
The best way to find hitches:
- Open txAdmin → Diagnostics → Performance
- Observe the graph over several minutes
- Every red spike shows a hitch with the causing resource
- Temporarily disable the causing resource and check if hitches disappear
OneSync Profiler
# In server.cfg set onesync_enableProfiler true The profiler shows detailed information in the console about sync load per player and resource.
5. Specific Optimizations
Database Optimization
# In server.cfg – test oxmysql with debug mode set mysql_connection_string "mysql://user:pass@localhost/fivem?charset=utf8mb4" set mysql_slow_query_warning 100 # Warns on queries over 100ms
Limit Script Tick Rate
`# In server.cfg – global tick rate set sv_networkTickRate 30 # Default: 60, reduces CPU load by ~30%
In individual scripts – reduce loop speed
Citizen.CreateThread(function() while true do Citizen.Wait(500) -- Instead of 0ms – 500ms is enough for most checks -- Script logic end end)`
Streaming for Large MLOs
-- In fxmanifest.lua or client.lua – set priorities SetStreamingPriority(GetHashKey('my_mlo'), 0) -- 0 = highest priority
6. Emergency Measures for Acute Hitches
- Stop all non-essential scripts: In the console, stop scripts one by one and check if hitches disappear
- Temporarily limit player count:
sv_maxclients 32– fewer players = less sync load - More aggressive OneSync culling:
onesync_distanceCull 300(default: 424) - Restart server: Sometimes only a restart helps – especially after long runtime, memory leaks can cause hitches
Common Problems and Solutions
Hitches only with certain actions:
- When entering a specific interior → MLO too large or defective
- When opening inventory → database query unoptimized
- When a specific player joins → too much data loaded at once
Hitches at certain times:
- Check if a cronjob or backup is running at that time
- Check autosave interval – every server save can cause a brief hitch
Hitches get worse over time:
- Classic sign of memory leaks – restart server regularly (every 6-12 hours)
- Check if a script collects data in a loop without releasing it
Quick Checklist
- Open txAdmin Performance Graph and identify hitches
- Find the causing resource (txAdmin shows it directly)
- Check and optimize the resource's database queries
- Check loops in code for Wait() – no Wait(0) in production
- Check streaming assets for size and quantity
- Optimize client-side graphics settings
- Restart server regularly (every 6-12 hours)