Back to Blog

How to Reduce Minecraft Server Lag

How to Reduce Minecraft Server Lag
Command of the Day
nice -n -10 java -jar server.jar

What it does: Launches the Minecraft server process with an elevated scheduling priority (nice value -10) so the CPU prioritizes game ticks.

Server lag is the number one enemy of multiplayer Minecraft server communities. Whether it manifests as rubberbanding, slow block breaking, or delayed mob pathfinding, server lag degrades the player experience.

To fix lag effectively, you must distinguish between Server Tick Lag (low TPS), Client FPS Lag, and Network Latency (high ping). In this guide, we focus on eliminating server-side tick lag on your RivinCloud VPS.


1. Step 1: Diagnose the Lag Source

Before tweaking configuration files randomly, use profiling tools to isolate the exact cause of lag:

A. Run Spark Profiler

If running Paper or Fabric, Spark is the gold standard for performance diagnostics:

/spark profiler start
# Wait 3-5 minutes during peak lag, then run:
/spark profiler stop

The output link provides a flame graph showing whether CPU time is spent on villager pathfinding, hopper ticking, block lighting, or third-party plugin events.

B. Check MSPT and TPS

Use /mspt to see if your server takes longer than 50ms per tick.


2. Step 2: Essential Server Configuration Fixes

A. Pre-generate World Chunks

Generating new world terrain dynamically when players fly or ride boats creates massive CPU spikes. Pre-generate world boundaries using the Chunky plugin:

/chunky radius 5000
/chunky start

Run this while no players are online before launching your server publicly.

B. Limit Entity Activation Ranges

In spigot.yml, reduce how far away mobs begin processing pathfinding AI:

world-settings:
  default:
    entity-activation-range:
      animals: 16
      monsters: 24
      raiders: 32
      misc: 8

C. Optimize Hoppers

Hoppers are a notorious cause of redstone lag. In paper-world.yml:

ticks-per:
  hopper-transfer: 8
  hopper-check: 8

3. Step 3: Hardware & Process Prioritization

Ensure your Linux VPS allocates maximum system resources to the Java process.


Command of the Day: nice / renice

The nice command launches a process with a specified scheduling priority. In Linux, priority values range from -20 (highest priority, most CPU preference) to 19 (lowest priority).

Syntax

nice -n [niceness_value] [command]

Practical Example

# Launch Java with higher CPU scheduling priority (requires sudo/root)
sudo nice -n -10 java -Xms4G -Xmx4G -jar paper.jar --nogui

Renice an Already Running Server

# Find the PID of Java, then adjust niceness
renice -n -10 -p $(pgrep -f "paper.jar")

Explanation

Giving your Minecraft server process a negative niceness value instructs the Linux kernel scheduler to assign CPU execution slots to Java before lower-priority background tasks.


Common Mistakes

  • Throwing more RAM at CPU lag: If CPU single-thread capacity is saturated, adding 16GB of extra RAM will not increase TPS.
  • Ignoring unoptimized plugins: Running outdated plugins designed for single-threaded Spigot on modern Paper setups can lock the main thread.

Troubleshooting

  • Server crashes with "Watchdog" error: The main thread was frozen for over 60 seconds. Inspect the crash log in logs/crash-reports/ to see which plugin or entity caused the freeze.
  • Rubberbanding despite 20.0 TPS: Check player network ping or inspect server bandwidth utilization.

Best Practices

  • Upgrade to Paper or Purpur server software.
  • Manage plugins easily using RivinCloud's Game Panel features like the built-in Plugin Installer and Player Manager wrapped in the sleek Nebula theme.
  • Keep simulation distance between 3 and 5.

Frequently Asked Questions

What is the difference between TPS and Ping?

TPS measures how fast the server processes game logic (ideal: 20.0). Ping measures the network latency in milliseconds between a player's PC and the server host.

Does mob stacking reduce lag?

Yes. Plugins that stack nearby animals and monsters reduce total active entity collision checks.


Conclusion

Reducing Minecraft server lag requires systematic diagnosis: pre-generate chunks, tune entity activation ranges, optimize hopper mechanics, and prioritize Java process scheduling on your RivinCloud VPS.