Optimize Server Performance
Fix lag, reduce desync, and optimize your Valheim dedicated server. Covers zones, instances, network tuning, and building limits.
Valheim servers can experience lag and desync, especially with many players, large builds, or lots of mods. Understanding how the game works under the hood helps you diagnose and fix performance issues.
How Valheim's Zone System Works
Valheim's world is divided into 64m x 64m zones. The server loads and unloads zones dynamically around each player:
| Range | Size | What's Loaded |
|---|---|---|
| Active zones | 3x3 | Creatures move, AI runs, spawners activate |
| Loaded zones | 5x5 | Objects, terrain, and buildings are in memory |
| Generated zones | 9x9 | Locations and vegetation pre-generated |
The critical insight: Valheim is not fully server-authoritative. The first player to enter an area becomes the "zone host" for that area's physics and AI. If that player has a weak PC or poor connection, everyone in that area experiences lag.
This means:
- Players spread across the map = more zones loaded = more server work
- Each player's hardware quality affects the experience for others nearby
- Large builds create many objects (instances) that must be synced across the network
The Instance Problem
Every placed object in Valheim is an instance — building pieces, terrain modifications, dropped items, creatures, torches. Press F2 in-game to see your current instance count.
Instance Thresholds
| Instance Count | Performance Impact |
|---|---|
| Under 8,000 | Smooth gameplay |
| 8,000–10,000 | Stuttering begins |
| 12,000+ | Significant lag on most hardware |
| 15,000+ | Severe performance drops, physics glitches |
What Creates the Most Instances
- Torches and campfires — each creates multiple instances plus smoke particles
- Terrain modifications — every pickaxe/hoe action creates a permanent object
- Tamed animals and crops — each has AI or growth logic
- Dropped items — unpicked loot on the ground
- Glass building pieces — reflections add rendering overhead
Reading the F2 Network Stats
Press F2 to see the debug overlay:
| Stat | What It Means |
|---|---|
| Instances | Total tracked objects loaded around you — the primary performance metric |
| send_queue | Bytes waiting to be sent. If climbing, your client is generating data faster than the network can handle |
| recv_queue | Bytes waiting to be processed. Growing recv_queue means data is arriving faster than your client can process |
| Ping | Round-trip time to the server in ms. Under 100ms is good |
Diagnosis: If instances are high (8,000+) and send_queue is growing, you're in an area that's overwhelming the network. Reduce building complexity or use optterrain.
Fix Terrain Lag with optterrain
Old terrain modifications (from before patch 0.150.3) store each individual pickaxe/hoe action as a separate object. The optterrain command converts these to the new system that stores just the end result.
Open the console
Press F5.
Run the command
optterrainThis converts terrain within ~150 meters. Check your F2 instance count before and after — reductions from 17,000 to 9,000 have been reported.
⚠️ Warning: Back up your world before using
optterrain. It can occasionally warp terrain near existing buildings.
Scheduled Restarts
Valheim servers accumulate memory over time. Regular restarts are the single most effective performance fix.
Go to Schedules in the sidebar and create a daily restart during off-peak hours. See Scheduled Restarts.
| Server Type | Recommended Frequency |
|---|---|
| Small (1–5 players) | Once daily |
| Medium (5–10 players) | Once or twice daily |
| Large (10+ players) | Every 8–12 hours |
| Heavily modded | Every 6–8 hours |
Reduce Build Complexity
The most impactful optimization:
- Keep bases compact — fewer building pieces means fewer instances
- Limit torches and fires — each one creates particles and instances
- Avoid excessive terraforming — every terrain modification is permanent
- Pick up dropped items — loot on the ground counts as instances
- Consolidate bases — one large base is better than many scattered ones
Mod Optimization
Install BetterNetworking
The BetterNetworking mod optimizes network traffic between server and clients, reducing desync. Install through the Mods panel in the sidebar.
Remove Unused Mods
Each mod adds processing overhead. Only keep mods you actively use.
Check Mod Compatibility
Outdated mods cause lag spikes and crashes. Check Thunderstore for update status after game patches.
Crossplay Overhead
If all your players use Steam, disabling crossplay removes PlayFab relay overhead:
Go to Startup, find the Crossplay toggle, and disable it. Restart your server.
Server Hardware Guidelines
RAM
| Players | Vanilla | Modded |
|---|---|---|
| 1–5 | 2–3 GB | 4–5 GB |
| 5–10 | 4–6 GB | 6–8 GB |
| 10+ | 6–8 GB | 8–12 GB |
CPU
Valheim relies heavily on single-thread performance. Higher clock speed per core matters more than core count because physics runs on one thread.
Network Bandwidth
| Players | Minimum Upload |
|---|---|
| 1–5 | 5 Mbps |
| 5–10 | 10–15 Mbps |
| 10+ | 20+ Mbps |
Dealing with Desync
Desync happens when a player's client falls out of sync with the server but stays connected. Symptoms:
- Chests take 10–30 seconds to open
- Other players appear frozen or teleporting
- Actions don't register
Fix: The affected player should disconnect and reconnect. If it happens frequently, check:
- The zone host's hardware and connection quality
- Instance count in the problem area
- Whether BetterNetworking mod is installed
Related Guides
See also: Scheduled Restarts | Install Mods | Troubleshooting Network | Increase Player Limit
If you need help, join our Discord.
How is this guide?
