Skip to main content

Optimize your FiveM server

This guide gives you tips to optimize your FiveM server performance.

Server configuration​

server.cfg​

# Limit entities
setr sv_maxclients 64
setr onesync_distanceCullVehicles 300
setr onesync_distanceCulling 300

# Disable excessive logs
sv_scriptHookAllowed 0

Resource optimization​

Identify slow resources​

In txAdmin, check the Performance to see which resources consume the most.

Best practices​

  1. Avoid infinite loops - Use appropriate delays
  2. Optimize SQL queries - Use indexes
  3. Limit network events - Group data
  4. Clean entities - Remove abandoned vehicles

Database optimization​

-- Add indexes on frequently used tables
ALTER TABLE users ADD INDEX idx_identifier (identifier);

Optimization resources​

Install cleanup resources:

  • Garbage collector for vehicles
  • Automatic entity cleaner

Monitoring​

Regularly monitor:

  • CPU usage
  • RAM usage
  • Server tick rate
tip

A stable tick rate around 60ms indicates a well-optimized server.