Server lag is rarely caused by what people blame it on. It's almost never the framework. It's usually a single rogue resource, a misconfigured database, or 90 streamed vehicles that nobody drives. Here is how to actually find the cause.
Start with resmon, not Discord theories
Open the in-game resource monitor (F8 -> resmon). Sort by ms. Anything consistently above 1.0ms during normal play deserves a hard look. Don't trust a single spike — watch averages across 30 minutes.
OneSync settings matter
Run OneSync Infinity if you have more than 32 players, and set onesync_population and onesync_distanceCullVehicles correctly. Default values are conservative and waste CPU on entities nobody can see.
The 15-tip checklist
- Remove every script you might use someday — delete, don't disable.
- Replace any free inventory script with ox_inventory.
- Replace target markers with ox_target.
- Cap your streamed vehicle count to what players actually drive.
- Run the database on the same machine as the server, or on a 1ms-latency LAN box.
- Use oxmysql; remove ghmattimysql and mysql-async if they are still in your stack.
- Configure sv_maxClients honestly — don't oversell.
- Optimize fxmanifest.lua files: only stream files you actually use.
- Audit any resource using a CreateThread loop with Wait(0) — that is almost always wrong.
- Move large image assets out of UI HTML and into stream folders served via NUI properly.
- Disable client-side console spam in production.
- Check your txAdmin schedule for restart-loops eating memory.
- Verify your VPS has dedicated cores, not shared burstable ones.
- Disable mods that double-load assets (especially old NoPixel-style packs).
- Restart the server every 12 hours during your beta. Memory leaks happen.
Wrapping up
Performance is boring math, not a vibe. If you measure first and change one thing at a time, you will cut your average tick time in half within a week.
Written by
Sarah Chen
Server-owner-friendly tutorials, every week. Browse the marketplace for premium FiveM resources or reach out if you need a custom build.
