The message "server thread hitch warning" in the FiveM console means a script has blocked the main thread for longer than 150 ms. Players notice this as lag, teleport glitches, vehicles freezing or NPCs that stop responding. The problem is almost always in a resource, not in the hardware.
What happens technically
The FiveM server runs everything on a single thread. Every tick must finish within 16 ms to achieve 60 ticks per second. When a script needs 150 ms or more for a single operation, FiveM prints the hitch warning. The server falls behind and has to catch up, which players experience as a brief freeze.
Step 1: find the cause with resmon
Connect to your server and open the F8 console. Type resmon 1. An overlay appears showing CPU and memory usage per resource. Any resource above 0.25 ms is worth looking at. Above 1 ms is suspicious. Above 5 ms is almost certainly the cause of your hitch warnings.
Step 2: server-side profiler
Resmon shows the client-side view. For server-side problems, use the built-in profiler:
- Type in the server console:
profiler record 500 - Wait for the recording to finish.
- Type:
profiler save myprofile - Type:
profiler view myprofile
A link appears that you open in the browser. The profile shows per resource and per function how much time it used. Zoom in on the spikes: those are your hitch-causers.
Step 3: common causes
- Database queries without an index. A query like
SELECT * FROM users WHERE identifier = 'steam:xxx'on a table without an index onidentifiercan take tens of milliseconds per call. Add the proper indexes to your database. - Synchronous loops in Lua or JavaScript. A
while true dowithoutWait()blocks the thread permanently. Every loop in server-side code must have a wait. - Too many exports per tick. Exports called every tick instead of being cached or event-based stack up quickly.
- Unoptimized vehicle YTDs. Custom vehicles with 4096px textures while FiveM internally caps at 1024px. The server has to stream the textures to every client.
- Too many resources loading at once. A hundred resources is common on an RP server, but each script that fetches data from the database at startup causes a spike.
Step 4: fix it
- Remove or disable the heaviest resource and check if the hitches stop.
- Replace poorly coded free scripts with optimized alternatives. Paid scripts from known developers are often better optimized.
- Add database indexes. The most common:
ALTER TABLE users ADD INDEX (identifier); - Batch database queries instead of running them per player per second.
- Set up automatic restarts via txAdmin (every 6 to 12 hours) to limit memory leaks.
The FiveM plans at HostValues run on Ryzen 9 CPUs with high single-core clock speeds, which directly benefits tick time. For performance questions, our support team helps analyze your profiler output.
Are hitch warnings harmful to the server?
They do not cause permanent damage, but they make the player experience poor. With repeated hitches, players get disconnected or get stuck.
Does more RAM solve the problem?
Usually not. Hitch warnings are a CPU problem (the thread is blocked), not a memory problem. More RAM only helps if the server is actively swapping.
How do I prevent hitches at startup?
Hitch warnings at startup are normal; all resources load their data simultaneously. It is the hitches during gameplay that you need to fix.