A laggy FiveM server drives players away faster than anything else. Whether you are experiencing server-side hitches, client FPS drops, or long loading times, here is how to diagnose and fix performance issues systematically.
Understanding FiveM Performance
FiveM performance has two sides:
Server-side: How fast the server processes game logic, scripts, and player synchronization. Measured in server FPS (ideally near the tick rate) and script execution time.
Client-side: How smooth the game runs on each player's PC. Affected by streamed assets, local scripts, and total resource count.
Both sides need optimization for a smooth experience.
Diagnosing Performance Issues
Before optimizing, identify the bottleneck:
- Check server FPS using the server console or monitoring tools
- Monitor individual resource performance with
resmon(resource monitor) - Enable the resource monitor in-game to see which resources use the most time
- Check database query times if you use MySQL/MariaDB
- Monitor RAM and CPU usage on the host machine
The resource monitor (resmon 1 in the F8 console) shows milliseconds spent per resource per frame. Resources consistently above 1ms are worth investigating.
Script Optimization
Scripts are the number one cause of server-side performance issues:
Avoid tick-heavy scripts: Scripts that run code every frame (0ms tick) waste server time. Use longer intervals or event-based logic instead.
Reduce native calls: Each native function call has overhead. Cache results instead of calling the same native every frame.
Use server-side logic where possible: Client scripts run on every connected player's machine. Server scripts run once. Move logic server-side when it does not need per-player execution.
Remove unused resources: Every loaded resource consumes memory and may have background ticks. If you are not using it, remove it from your server.cfg.
Optimize database queries: Slow queries block the server thread. Index frequently queried columns, use prepared statements, and avoid SELECT * when you only need specific fields.
OneSync Configuration
OneSync is the networking mode that enables high player counts. Proper configuration matters:
- onesync on: Basic OneSync for up to 64 players
- onesync_population: Controls NPC density, reduce for better performance
- sv_maxClients: Set this to your actual expected peak, not an arbitrary high number
Higher player counts require more server resources. If you set max clients to 200 but your hardware struggles at 80, cap it lower for a better experience for everyone.
Streaming Optimization
Custom assets (vehicles, maps, peds) are streamed to players:
- Compress textures to reduce bandwidth
- Use appropriate LOD levels for custom models
- Limit total addon vehicles to what your community uses
- Group rarely-used assets into togglable resource packs
- Monitor total streaming bandwidth during peak hours
Large MLOs (custom interiors) and high-poly vehicle packs are common bandwidth killers.
Database Tuning
If your server uses MySQL or MariaDB:
- Enable query caching
- Set appropriate buffer pool sizes (at least 50-70% of available RAM for InnoDB)
- Index columns used in WHERE clauses and JOINs
- Use connection pooling in your scripts (oxmysql, mysql-async)
- Schedule cleanup queries during off-peak hours
- Monitor slow query logs to find problem queries
A well-tuned database can serve hundreds of queries per second without lag. A poorly configured one causes hitches every time a player opens inventory.
Hardware Requirements
For smooth performance at different player counts:
- 32 players: 4 CPU cores, 8 GB RAM, SSD
- 64 players: 6 CPU cores, 16 GB RAM, NVMe SSD
- 128+ players: 8+ CPU cores, 32 GB RAM, NVMe SSD, high bandwidth
FiveM is mostly single-threaded for game logic, so high single-core performance matters more than core count for the server process itself. The database and streaming benefit from additional cores.
Common Performance Killers
- Poorly written scripts with 0ms ticks and heavy native usage
- Unoptimized database queries without indexes
- Too many addon vehicles loaded simultaneously
- MLOs with excessive polygon counts
- Memory leaks in scripts that accumulate over uptime
- No regular server restarts (daily restarts help clear accumulated issues)
Server Restart Schedule
Schedule automatic restarts every 12-24 hours:
- Clears memory leaks
- Resets any accumulated lag
- Gives you a window for updates
- Players expect and accept brief restart downtime
Announce restarts in advance and schedule them during lowest player count hours.
FAQ
Why is my FiveM server lagging? Use resmon to identify which resource is consuming the most time. The top offender is usually a script with heavy per-frame execution.
Does more RAM help FiveM server performance? Beyond the minimum needed (8-16 GB), additional RAM helps database caching and streaming but does not directly fix script lag.
How many resources can a FiveM server run? There is no hard limit, but each resource adds overhead. Well-optimized servers run 100-200 resources. Poorly optimized ones struggle at 50.
Related: FiveM txAdmin guide, FiveM vehicle pack performance fix, Best FiveM server hosting