FiveM Server Tuning: server.cfg, OneSync and Monitoring
By Benjamin D. · PDG
· Updated on August 18, 2026 · 9 min read

Contents
A FiveM server that stays stable under load depends on a few measurable things: single thread CPU headroom for the main execution loop, memory that does not corrupt during long sessions, the parameters written into server.cfg, and the latency of the MySQL queries your framework fires on every player action. This guide covers the configuration that follows from them and the metrics that tell you when something is drifting.
Patreon Key Integration and Licensing Requirements
A FiveM server needs a Patreon key (previously known as “element club argentum” or similar tiers) to unlock the enhanced features and the player slots beyond the 32-player base limit.
The Patreon key unlocks critical capabilities including OneSync support (enabling 128+ player slots), increased entity limits, enhanced security features, and access to the FiveM Nucleus system. Without this key, servers remain limited to basic functionality unsuitable for serious roleplay communities.
Server Configuration Best Practices
Proper server.cfg configuration maximizes performance on dedicated hardware. Key parameters include:
sv_maxclients 64
sv_licenseKey "your_patreon_key_here"
onesync on
set mysql_connection_string "mysql://user:password@localhost/database"
set steam_webApiKey "your_steam_api_key"
sv_enforceGameBuild 2802
sv_scriptHookAllowed 0
exec resources.cfg
The sv_maxclients value should align with the resources actually available to the server: every slot costs time on the main thread and memory for the entities the player owns. Raise it only once the profiler shows headroom at the current player count, never the other way round.
Database optimization significantly impacts performance. FiveM servers using ESX or QBCore frameworks rely heavily on MySQL queries for player data, inventory systems, and persistent world state. Hosting this database locally on the same NVMe SSD reduces query latency from 50+ ms (remote database) to under 1 ms (local), improving script responsiveness noticeably.
Resource Management and Script Optimization
FiveM’s resource system allows extensive customization but requires careful management. Monitor resource consumption using the built-in profiler:
profiler record 60
profiler save
This captures 60 seconds of performance data, identifying scripts consuming excessive CPU time. Common culprits include poorly optimized vehicle shops, badly coded phone scripts, and inefficient loop implementations. Resources consistently exceeding 2-3 ms per tick warrant optimization or replacement.
Threading optimization improves multi-core utilization. While FiveM’s main execution thread remains single-threaded, asynchronous operations and native callbacks can leverage additional cores. Spare cores therefore absorb background tasks like database queries, file operations, and network I/O without stealing time from the main thread.
Performance Optimization and Monitoring
Keeping performance stable over time requires continuous monitoring and proactive optimization. Establish baseline metrics during low-load periods to identify degradation trends before they impact player experience.
Key Performance Indicators
- Server Tick Rate: Should maintain consistent 60 ticks/second under normal load; drops below 50 indicate performance issues
- Player Ping: Target sub-50 ms for local players, sub-150 ms for international connections
- Script Response Time: Individual resources should complete execution within 2-3 ms per frame
- Database Query Latency: Queries should complete within 1-5 ms on local databases
- Memory Usage: Stable pattern without continuous growth indicating memory leaks
Implement automated monitoring using tools like Grafana with FiveM-specific collectors. Track these metrics over time to identify performance degradation patterns correlating with specific resource additions or player count thresholds.
Scaling Strategies
As communities grow beyond single-server capacity (typically 128-200 players maximum), consider architectural approaches:
Horizontal Scaling: Deploy multiple FiveM instances handling different geographic regions or game modes (roleplay, racing, freeroam), each on dedicated hardware. This distributes load while maintaining manageable player counts per instance.
Vertical Scaling: Raise the memory allocation and the core count of a single instance. Because the main loop stays single-threaded, the per core clock speed sets the real ceiling long before the number of cores does: past a certain point, adding cores no longer raises the maximum player count.
Infrastructure Separation: Offload database operations to dedicated MySQL servers, web interfaces to separate web hosting, and voice services to external platforms. This isolates resource consumption and simplifies troubleshooting.
Backup and Disaster Recovery
Implement automated daily backups of critical server components: the resources folder, server.cfg, database dumps, and txAdmin configurations. Store backups on separate storage infrastructure (not the same NVMe SSD) to protect against hardware failures.
Test restore procedures monthly to verify backup integrity and document recovery time objectives.
For additional resilience, keep a secondary instance or a development environment that mirrors the production configuration. This enables thorough testing of framework updates, new resources, and configuration changes before deploying to the live player-facing server.
Security hardening should include regular txAdmin updates, firewall configuration limiting access to game ports only, and periodic password rotation for panel access, database credentials, and SSH keys. FiveM’s native security features combined with dedicated infrastructure provide strong protection against common attack vectors when properly configured.
For comprehensive server security guidance and best practices, consult the official FiveM documentation which provides detailed configuration references and security recommendations directly from the development team.
FAQ
What consumes memory on a 64-player FiveM server running ESX or QBCore?
Three things: the framework itself with its database operations, the resources loaded at startup, and the entities the server owns for every connected player. Custom content (100+ scripts, large maps, custom vehicles) is loaded once and stays resident, so it sets the floor; the player count moves the rest. Watch the trend rather than the absolute figure: a value that keeps climbing between restarts is a leak in a resource, not a capacity problem.



