# How to Optimize Your Valheim Server Performance (/docs/valheim/server-performance)



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 [#how-valheims-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 [#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-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 [#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 [#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 [#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.

<div className="fd-steps">
  <div className="fd-step">
    Open the console [#1-open-the-console]

    Press **F5**.
  </div>

  <div className="fd-step">
    Travel to the laggy area [#2-travel-to-the-laggy-area]
  </div>

  <div className="fd-step">
    Run the command [#3-run-the-command]

    ```
    optterrain
    ```

    This 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.
  </div>
</div>

Scheduled Restarts [#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](/docs/valheim/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 [#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 [#mod-optimization]

Install BetterNetworking [#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 [#remove-unused-mods]

Each mod adds processing overhead. Only keep mods you actively use.

Check Mod Compatibility [#check-mod-compatibility]

Outdated mods cause lag spikes and crashes. Check Thunderstore for update status after game patches.

Crossplay Overhead [#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 [#server-hardware-guidelines]

RAM [#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 [#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 [#network-bandwidth]

| Players | Minimum Upload |
| ------- | -------------- |
| 1–5     | 5 Mbps         |
| 5–10    | 10–15 Mbps     |
| 10+     | 20+ Mbps       |

Dealing with Desync [#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 [#related-guides]

See also: [Scheduled Restarts](/docs/valheim/scheduled-restarts) | [Install Mods](/docs/valheim/mod-setup) | [Troubleshooting Network](/docs/valheim/fix-network) | [Increase Player Limit](/docs/valheim/increase-player-limit)

If you need help, join our [Discord](https://discord.xgamingserver.com/).
