Exclusive Metin2 game shield on FreeBSD: Automatic siege mode, VIP list, and whitelist from your dashboard. See how it works
Create a server

Guide

How to Tell If Your Game Server's Lag Is Caused by the Network or the CPU

Players call everything “lag”: stuttering, teleportation, commands that take a while to respond. But a server that can’t process its tick and a network path that loses packets require different solutions, and using more CPU power won’t fix a bad network path. With three tests, you’ll know which one applies to you.

Quick Tip: Who Is Affected by Lag?

  • It affects everyone at the same time and the TPS (tick rate) drops: it's almost certainly a server performance issue.
  • It affects everyone at once, but the TPS remains stable: server network or an attack.
  • Does this affect a single player, or players in the same region or from the same Internet service provider: the route between them and the server.

Most servers display their tick rate: /tps in Paper and Spigot, or the console's performance statistics in other games.

Test 1: The Route, with mtr

mtr combines ping and traceroute and displays the packet loss and latency for each hop. Run it from the server to the IP address of an affected player:

sudo apt install -y mtr-tinymtr -rwbzc 100 198.51.100.25

The player can do the same in the opposite direction, using mtr on Linux or macOS, or WinMTR on Windows, pointing to the server's IP address.

To interpret this, only count the loss that continues through the last hop. If an intermediate router shows 40% but the subsequent routers and the destination show 0%, that router is simply limiting its ICMP responses and does not affect the connection. A loss that begins at one hop and persists until the end, or a latency hop that no longer decreases, is indeed a routing issue.

Test 2: The server's main execution thread

Almost all game servers simulate the world on a main thread. You might see 25% of total CPU usage while, at the same time, having one core at 100% that slows down the tick. Check it thread by thread with pidstat, which is included in the sysstat package:

sudo apt install -y sysstatpgrep -a javapidstat -t -p PID 2 10

Replace java with your game's process and PID with the number returned by pgrep. If a thread stays close to 100% in column %CPU while there is lag, you've found the bottleneck: reduce the view distance or simulation distance, check your plugins and mods, or look for a processor with better performance per core.

Test 3: What the game doesn't control

vmstat 2 15
  • st (steal): CPU time that the hypervisor has not allocated to your VPS. If this value remains above 5, you are sharing too much CPU.
  • wa (iowait): The process is waiting for the disk. This usually happens when the game saves the world; if it coincides with lag, space out the autosaves.
  • si and so are not zero: the system is using swap. A game server that paginates memory to disk will always experience lag; adjust the memory allocated to the game or add more RAM.

What if it's an attack?

A sudden lag affecting everyone, with normal TPS and incoming traffic spiking, is usually a denial-of-service attack. All Xernode services include DDoS network protection; if the problem persists, please open a ticket with the exact time and the mtr output so we can investigate it.

ext step

If the tests indicate performance per core, check the game server plans and retest with the same number of players.

Related guides