FiveM Performance Optimization 2025
Running a high-performance FiveM server requires careful optimization across CPU, RAM, network, and resources. This guide covers everything needed for smooth 64-256 player roleplay.
🎯 Performance Goals
- Tick Rate: Maintain 25-30 ticks per second
- FPS: Server-side 60 FPS minimum
- Latency: Under 50ms for local players
- Stability: No crashes for 24+ hours
CPU Optimization
Thread Configuration
# In server.cfg
sets sv_maxClients 64
sets sv_enforceGameBuild 2944
# Enable OneSync for better performance (recommended for 64+ players)
set onesync_enabled 1
set onesync_maxPlayers 128
Affinity & Priority
Windows
# Set process priority and affinity
# Run as Administrator
wmic process where name="FXServer.exe" CALL setpriority "high priority"
Linux
# Set nice value (lower = higher priority)
sudo renice -n -5 -p $(pidof FXServer)
# Assign to specific cores (example: cores 0-7)
taskset -c 0-7 ./FXServer.exe
CPU-Specific Optimizations
- Single-Thread Performance: FiveM relies heavily on single-thread. Prioritize clock speed over core count
- Disable Hyper-Threading: Can reduce context switching overhead
- Power Settings: High performance mode, disable sleep states
- Cooling: Prevent thermal throttling with adequate cooling
RAM Optimization
Memory Management
# In server.cfg
# Limit RAM usage (adjust based on your hardware)
set sv_maxMemoryUsagePercent 85
# Garbage collection tuning
set gtaThreadCount 4
Resource Cleanup
- Remove Unused Resources: Delete scripts not in use
- Limit Custom Vehicles: Each vehicle adds 50-200 MB RAM
- Optimize Entities: Reduce unnecessary world objects
- Monitor Usage: Use txAdmin to track RAM over time
Stream Distance Optimization
| Player Count | Recommended Stream Distance |
|---|---|
| 1-32 | 100-150 units |
| 32-64 | 75-100 units |
| 64-128 | 50-75 units |
| 128+ | 25-50 units |
Network Optimization
Bandwidth Management
# Calculate needed bandwidth
# Base: 4 Mbps per player + 20% overhead
Bandwidth = (Players × 4 Mbps) × 1.2
# Examples:
# 32 players: 154 Mbps
# 64 players: 308 Mbps
# 128 players: 614 Mbps
Network Stack Optimization
- UDP Buffer Size: Adjust in server.cfg for player count
- TCP Window: Maximize for file transfers
- QoS: Prioritize game traffic on your network
- DNS: Use fast DNS servers (Google, Cloudflare)
Resource Optimization
ESX/QBCore Framework Tuning
ESX Optimization
# In ESX config files
# Reduce sync intervals
Config.SyncInterval = 5000 # milliseconds
# Enable caching
Config.EnableCache = true
# Optimize database queries
Config.QueryCache = true
QBCore Optimization
# In QBCore config files
# Reduce tick rate if needed (default is 30)
Config.TickRate = 30
# Enable async operations
Config.AsyncMode = true
# Optimize vehicle syncing
Config.VehicleSyncRate = 20
Vehicle Optimization
- Limit Active Vehicles: Max 2-3 per player
- Use Optimized Models: Lower poly counts
- Custom Vehicle Packs: Choose quality packs over quantity
- Remove Unused Vehicles: Delete from server
Entity Management
- Stream Optimization: Reduce render distance for non-essential entities
- LOD Models: Use lower-detail models at distance
- Dynamic Objects: Minimize dynamic vs static objects
- Cleanup Scripts: Remove entities when players leave area
Database Optimization
MySQL Performance
# In my.cnf
[mysqld]
# InnoDB buffer pool (70-80% of RAM for dedicated DB server)
innodb_buffer_pool_size = 8G # Adjust based on your RAM
# Query cache
query_cache_size = 256M
# Connection pool
max_connections = 200
thread_cache_size = 16
# Logging (disable for performance, enable for debugging)
general_log = 0
slow_query_log = 0
Index Optimization
- Index Frequently Queried Columns: Player IDs, vehicle plates, etc.
- Analyze Query Performance: Use EXPLAIN for slow queries
- Regular Maintenance: Optimize tables weekly
File System Optimization
Storage Configuration
- NVMe SSD: Required for 64+ players
- Separate Drives: OS, MySQL, and game files on different drives
- File System: ext4 (Linux) or NTFS (Windows) with proper alignment
Log Management
# Implement log rotation
# Linux
logrotate -f /etc/logrotate.d/fivem
# Windows: Use scheduled task
# Archive logs older than 7 days
# Compress logs older than 30 days
OneSync Configuration
OneSync Infinity
# In server.cfg
# Enable OneSync
set onesync_enabled 1
# Max players (OneSync handles more than legacy)
set onesync_maxPlayers 128
# Distance-based culling
set onesync_distanceCull 250.0
# State bag settings
set onesync_stateBagEnabled 1
set onesync_stateBagRate 1000
OneSync Benefits: Better performance for 64+ players, improved synchronization, reduced bandwidth usage.
Monitoring & Troubleshooting
Performance Monitoring
- txAdmin Dashboard: Real-time CPU, RAM, and network metrics
- Player Commands:
/reportto collect player performance data - Tick Rate Monitoring: Watch for drops below 20 ticks/s
- FPS Monitoring: Server-side should stay above 60 FPS
Common Performance Issues
Lag spikes every 5 minutes?
Check for auto-save intervals. Stagger saves across 5-minute periods or move to asynchronous saves.
Players rubberbanding?
Network synchronization issue. Check bandwidth and ensure OneSync is properly configured.
Server CPU at 100%?
Reduce player count or remove resource-heavy scripts. Check for resource leaks using memory profiling.
Slow database queries?
Run EXPLAIN on slow queries, add indexes, and consider query caching.
Performance Benchmarks
| Configuration | Expected Tick Rate | Max Stable Players |
|---|---|---|
| 32 players, 8 GB RAM, 4 cores | 25-30 ticks/s | 32 |
| 64 players, 16 GB RAM, 6 cores | 25-30 ticks/s | 64 |
| 128 players, 32 GB RAM, 8 cores | 20-25 ticks/s | 128 |
| 256 players, 64 GB RAM, 12 cores | 18-22 ticks/s | 256 |
💡 Pro Tips
- Profile Before Optimize: Measure performance baseline before making changes
- One Change at a Time: Test each optimization individually
- Player Feedback: Ask players about performance, not just metrics
- Regular Audits: Review resources monthly for optimization opportunities
Frequently Asked Questions
What's the most important setting for performance?
OneSync configuration and player count matching your hardware. These two factors have the biggest impact.
Can I run 128 players on 16 GB RAM?
Possible but not recommended. You'll need very optimized resources and may experience performance issues. 32 GB is minimum for 128 players.
How often should I restart the server?
Every 6-12 hours helps clear memory leaks and maintain stability. Schedule during low-activity periods.
Does using Linux improve performance?
Yes, Linux has lower overhead (10-15% resource savings) and better networking stack. However, Windows is easier to manage for beginners.
Next Steps
- Ensure your hardware meets requirements
- Set up your optimized server
- Choose performance-optimized framework
- Resolve performance issues
Need Guaranteed Performance? Supercraft provides enterprise-grade FiveM hosting with guaranteed resources and optimization support.