How to Set Up a Minecraft Server Without Lag: JVM Flags, Tick Rate, and Hardware That Deliver 20 TPS

Most Minecraft server lag is not caused by “too many players” or “slow internet.” It is caused by specific, measurable problems: incorrect JVM garbage collection settings, unoptimized world generation, excessive entity counts, and the wrong server software. These problems are all solvable with the right configuration and hardware. This guide walks you through a complete server setup—from bare metal to 20 TPS—that stays smooth even at 100+ players.

If you are still choosing hardware, compare dedicated server plans with high single-core CPUs and fast NVMe storage to find a configuration that matches your player count.

Step 1: Choose the Right Server Software

Vanilla Minecraft server JAR is the baseline, but it is also the worst performer. For a lag-free server, use one of these:

  • Paper — The industry standard. Includes patch optimizations, redstone timings, and entity activation ranges that reduce CPU load by 40–60% compared to vanilla.
  • Purpur — Paper fork with additional config options for lag reduction, including per-player mob spawns and tick-rates.
  • Tuinity / Airplane — Optimized for larger servers. Airplane provides per-tick profiling built in.

Do not use Bukkit, CraftBukkit, or Spigot for new servers—they are unmaintained and lack the performance patches of Paper and its forks.

Step 2: Configure JVM Flags for Lag-Free GC

Garbage collection pauses are the single biggest cause of tick-rate stutter on Minecraft servers. The default JVM flags are optimized for desktop applications, not real-time game loops. Use these flags for a Paper/Purpur server with 8–16 GB allocated:

java -Xms8G -Xmx12G -XX:+UseG1GC -XX:+ParallelRefProcEnabled \
     -XX:MaxGCPauseMillis=100 -XX:+UnlockExperimentalVMOptions \
     -XX:+DisableExplicitGC -XX:+AlwaysPreTouch \
     -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 \
     -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 \
     -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 \
     -XX:InitiatingHeapOccupancyPercent=15 \
     -XX:G1MixedGCLiveThresholdPercent=90 \
     -XX:G1RSetUpdatingPauseTimePercent=5 \
     -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem \
     -XX:MaxTenuringThreshold=1 \
     -jar paper.jar nogui

These flags keep GC pauses under 50 ms even at 12 GB heap usage. The key settings are G1GC (pauses GC into predictable small windows) and InitiatingHeapOccupancyPercent=15 (starts GC early, avoiding large stop-the-world pauses).

Step 3: Pre-Generate the World

World generation is the most expensive single operation in Minecraft. If a player explores to ungenerated chunks, the server must generate them on the fly, which causes visible lag spikes. Use a pre-generation plugin like Chunky to generate 10,000–50,000 blocks in all directions before you open the server to players. This completely eliminates exploration lag.

Example Chunky command: /chunky radius 15000 then /chunky start. On a modern dedicated server with NVMe, pre-generating a 15,000-block radius takes 2–4 hours. Run it overnight.

Step 4: Tune paper.yml and spigot.yml

SettingDefaultRecommendedWhy
entity-activation-range3216Reduces CPU cost for distant entities
max-entity-collisions82Collision calculations are expensive at scale
mob-spawner-tick-rate13Spreads mob AI ticks across more server ticks
nerf-spawner-mobsfalsetrueStops spawner mobs from pathfinding
redstone-implementationVANILLAALTERNATIVEAlternative redstone uses 80% less CPU

Apply these changes to paper.yml, restart the server, and monitor TPS in the console. Most servers see TPS stabilize at 20.0 (flat) after these changes alone.

Step 5: Size RAM Correctly for Your Player Count

RAM allocation is a Goldilocks problem. Too little causes OOM crashes; too much forces the JVM to scan more memory during GC pauses, which creates lag. For a vanilla Paper server, allocate 1 GB per 10–20 players plus 2 GB for the OS and overhead. A 50-player server needs 6–8 GB of heap. A 200-player server needs 12–16 GB. For modded servers, multiply these numbers by 1.5–3x depending on the modpack. Never allocate more than 16 GB to a single Minecraft instance — beyond that, the GC overhead from sweeping a large heap causes more lag than the extra memory saves.

Common Mistakes That Cause Lag

Three mistakes consistently cause lag on otherwise well-configured servers. First, allowing unlimited mob spawns in spawn chunks. Set spawn-chunk-mob-limit to 0 in paper.yml to stop mobs from accumulating in the always-loaded spawn area. Second, running multiple heavy plugins that scan all players or all entities every tick — use a profiling plugin to identify which plugins are consuming the most tick time. Third, using the default -Xmx without -Xms set to the same value; the JVM wastes time reallocating heap regions when Xms is lower than Xmx. Always set both to the same number.

Step 6: Monitor and Maintain

Use the /timings command (Paper) to capture a 10-minute performance report. Upload the result to timings.aikar.co for analysis. Look for patterns: high entity tick time means too many mobs, high chunk tick time means ungenerated terrain, high memory usage means GC tuning is off. Address these one at a time.

For hardware recommendations that match your target player count, visit our dedicated server comparison table and filter by CPU single-core performance and RAM size.

A lag-free Minecraft server is not a myth. Pre-generate the world, tune your JVM, use Paper, and cap your entities. That combination delivers 20 TPS at 100+ players on a properly sized dedicated server, every time.

Leave a Reply