MCTOOLBOX
MC ToolboxMC TOOLBOX

April 16, 2026

Server & Performance

Minecraft Server Optimization: Spark Profiling, JVM Flags & Paper Tuning

Fix server TPS lag spikes with optimal Aikar JVM startup flags, Paper.yml entity tick limits, and chunk loading settings.

Running a smooth Minecraft server with 20+ players requires careful Java Virtual Machine (JVM) tuning and server configuration. Default Paper or Spigot settings tick too many entities and waste RAM on unoptimized Garbage Collection.

Recommended Aikar JVM Startup Flags

Copy these optimized G1GC flags into your server start script (adjust RAM to match your server, e.g., 6G - 10G):

Minecraft server console showing 20.0 TPS and G1GC garbage collection performance
java -Xms8G -Xmx8G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=15 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 --add-modules=jdk.incubator.vector -jar paper.jar nogui

Paper.yml Key Optimization Settings

  • max-auto-save-chunks-per-tick: Set to 6 (reduces disk I/O lag).
  • despawn-ranges.soft: Set to 28 / hard: Set to 96.
  • entity-activation-range: Reduce tick ranges for passive animals and villager pathfinding.

Generate custom Windows (.bat) and Linux (.sh) start scripts with tuned flags using our Server Start Script Generator!

Profile before changing configuration

  1. Reproduce the lag with the normal player load.
  2. Run Paper's bundled Spark profiler while the issue is active.
  3. Identify whether time is spent in a plugin, entities, chunk generation, block entities or garbage collection.
  4. Change one relevant setting and capture another report under the same workload.

JVM flags are not a universal lag fix

Garbage-collector flags can improve pause behavior, but they cannot repair a plugin that blocks the main thread or a farm that creates excessive entities. Allocate enough memory for the workload without assigning all system RAM, keep Java at the version required by the server release and monitor actual heap use.

Avoid copying large optimization configuration files from unrelated servers. Paper defaults change, and reducing simulation or activation ranges can alter gameplay. Keep a backup, document every change and revert settings that do not produce a measurable improvement.

Gio Nui

Gio Nui

Independent web developer and editor of MC Toolbox. Guides are maintained alongside the site's browser-based Minecraft tools, with commands, file formats and version notes reviewed during updates.

More Guides