keepcalculator

06 Numbers and Powers

Improve Valheim Server Performance: A Measured Guide

Card No. 06·27148 · Updated · Standard formula, shown below

This guide shows you how to improve Valheim server performance using a measurement-led approach. Instead of guessing, you’ll learn to identify the actual bottleneck—CPU, RAM, network, or disk—and apply targeted fixes that give the biggest gains. You’ll need access to your server’s command line (or hosting control panel) and a basic understanding of server administration.

What You’ll Need

  • Administrator access to your Valheim server (root or sudo on Linux, admin on Windows).
  • SSH client (like PuTTY) if your server is remote.
  • A text editor (nano, vim, or Notepad).
  • Basic familiarity with command-line interfaces.

Step-by-Step

  1. Measure baseline server load. Before changing anything, record your server’s current performance. Run top or htop (Linux) or open Task Manager (Windows) and note CPU usage, memory usage, and load average. Also, note the number of players online and the world size (in MB). This gives you a reference point.
  2. Identify the bottleneck. Watch the metrics while players are active. If CPU usage is consistently above 80%, your CPU is the limiting factor. If memory usage is near 100% and the system starts swapping, you need more RAM. If network latency is high but CPU/RAM are fine, the issue is bandwidth or routing. Disk I/O can also be a culprit, especially on mechanical drives—check with iostat (Linux) or Resource Monitor (Windows).
  3. Optimize CPU usage: adjust the thread count. Valheim uses a single main thread for most world simulation. If you have a multi-core CPU, you can allocate more threads for other tasks. In your server’s launch arguments (or start script), add -threads followed by a number. A good starting point is the number of physical cores minus one (e.g., -threads 3 on a 4-core CPU). Test different values to find the sweet spot—too many threads can cause overhead.
  4. Reduce CPU load: lower the save interval. Frequent autosaves cause CPU spikes. In the server’s valheim_server.cfg file (or via the command line), set saveinterval to a higher value, like 1800 (30 minutes) instead of the default 900 (15 minutes). This reduces the frequency of world writes, freeing CPU for gameplay.
  5. Optimize RAM: adjust the memory allocation. If you’re self-hosting, ensure the server has enough RAM. Valheim typically uses 2-4 GB. On Linux, you can set the ulimit or use a systemd service file to cap memory. On Windows, you can’t directly limit it, but you can close other memory-hungry applications. If you’re on a hosting plan, consider upgrading to a plan with more RAM.
  6. Improve network performance: check your upload speed. Valheim servers require a stable upload speed, especially with many players. Use a speed test to check your upload. If it’s below 10 Mbps, you may experience rubber-banding. You can also set maxplayers to a reasonable number (e.g., 5-8) to reduce bandwidth demand.
  7. Enable or adjust the server’s ‘public’ setting. If your server is set to public=1, it broadcasts to the server list, which can cause slight overhead. Set it to public=0 if you only play with friends via IP. This reduces network chatter.
  8. Use a dedicated machine or upgrade your hosting plan. If you’re running the server on the same machine you play on, you’re competing for resources. Move to a dedicated server (even a low-cost VPS) or upgrade your hosting plan to one with a faster CPU (like an Intel i7 or AMD Ryzen) and NVMe SSD storage.
  9. Monitor after changes. After each change, repeat the baseline measurement from step 1. Compare CPU, RAM, and network usage. Did the change help? If not, revert it and try another. This measurement-led approach ensures you’re not making changes that don’t improve performance.
  10. Consider world optimization. Large, heavily built worlds can cause lag. If your world file is over 100 MB, consider using a tool like World Optimizer to remove unused instances and reduce file size. This can significantly reduce CPU load during exploration.

Common Mistakes

  • Changing settings without measuring first. You can’t tell if a change helped if you don’t have a baseline. Always measure before and after.
  • Setting -threads too high. More threads isn’t always better. Valheim’s main thread is the bottleneck; adding too many worker threads can cause context-switching overhead and actually reduce performance.
  • Ignoring disk I/O. If your server runs on a slow HDD, world saves and loading can cause stutters. Move to an SSD if possible.
  • Overlooking the OS overhead. Running other services on the same machine (like a web server or Discord bot) can steal CPU and RAM. Close unnecessary processes.

Tips

  • Use a server manager tool. Tools like Valheim Plus or BepInEx can give you more control over server settings, but be careful—mods can introduce their own performance issues.
  • Regularly restart your server. Memory leaks and accumulated garbage can degrade performance over time. A daily restart can keep things snappy.
  • Keep your server software updated. Iron Gate regularly releases patches that fix bugs and improve performance. Always update to the latest version.
  • Test with a stress scenario. Have a few friends join and build/explore to simulate load. This gives you a realistic picture of performance under pressure.

Troubleshooting

If the steps above don’t improve performance, consider the following:

  • Check for mod conflicts. If you’re using mods, disable them one by one to see if a specific mod is causing lag.
  • Verify your network connection. If you’re hosting from home, your ISP may be throttling gaming traffic. Try a VPN or contact your ISP.
  • Check the server log. The valheim_server.log file can contain error messages that point to the issue. Look for lines mentioning ‘timeout’ or ‘exception’.
  • If all else fails, try a fresh world. A corrupted or overly complex world can cause persistent lag. Create a new world and see if performance improves. If it does, the old world is the problem.

Frequently Asked Questions

How many players can a Valheim server handle?

Officially, the game supports up to 10 players, but performance degrades with more players. With a good CPU and network, 5-8 players is a comfortable number. Beyond that, you’ll likely see lag regardless of settings.

What is the ideal CPU for a Valheim server?

A CPU with high single-core performance is best, because the game’s main simulation runs on one thread. An Intel Core i5 or AMD Ryzen 5 from the last few years is sufficient. Avoid older or low-power CPUs.

How much RAM does a Valheim server need?

For a small server (1-5 players), 2-4 GB is enough. For larger groups, 4-6 GB is safer. The server uses more RAM as the world grows and more players join.

Can I run a Valheim server on a Raspberry Pi?

Technically yes, but it’s not recommended. The Pi’s CPU is too weak for smooth gameplay, and you’ll likely experience severe lag with more than a couple of players. A low-cost VPS is a better option.

Why does my server lag even with low player counts?

This is often due to a slow CPU or network. Check your CPU usage—if it’s maxed out, the server is struggling to process the world. Also, ensure your upload speed is adequate (at least 5 Mbps).

Is it better to host on Linux or Windows?

Linux generally uses fewer resources and is more stable for long-running servers. Many hosting providers use Linux. If you’re comfortable with the command line, Linux is a good choice. Windows is easier for beginners but may consume more resources.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →