Minecraft 1.21 Purpur Server Optimization: Aikar's JVM Flags & Tick-Loop Tuning

· 7 min read

Running a Minecraft 1.21.x server for a large player community requires careful JVM memory management and main thread (Server Thread) optimization. Vanilla and default Spigot configurations often struggle to maintain a locked 20.0 TPS (Ticks Per Second) under heavy farm and chunk load.

1. Why Is Purpur the Current Industry Standard?

ThePurpurengine is a fork of Paper and Pufferfish that introduces low-level server loop optimizations:

2. Optimal Aikar's JVM Startup Flags for Java 21

Properly tuning the Java Virtual Machine (JVM) eliminates micro-stutters (GC pauses). Default garbage collection can freeze the server for ratusan milliseconds; Aikar's G1GC flags solve this:

java -Xms10G -Xmx10G -XX:+UseG1GC \
-XX:+ParallelRefProcEnabled \
-XX:MaxGCPauseMillis=200 \
-XX:+UnlockExperimentalVMOptions \
-XX:+DisableExplicitGC \
-XX:+AlwaysPreTouch \
-XX:G1NewSizePercent=30 \
-XX:G1MaxNewSizePercent=40 \
-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 \
-Dusing.aikars.flags=https://mcflags.emc.gs \
-Daikars.new.flags=true \
-jar purpur.jar --nogui
Important Rule:Always set-Xms(initial heap) and-Xmx(maximum heap) to the exact same value. This prevents OS-level heap resizing and stabilizes tick times.

3. Key Configuration Parameters

Filepufferfish.yml:

Ensure Dynamic Activation of Brain (DAB) is enabled for distant entities:

dab:
  enabled: true
  max-tick-freq: 20
  activation-dist-mod: 8

Filepurpur.yml:

Disable unnecessary raycast checks and optimize keepalive handling:

settings:
  use-alternate-keepalive: true
  lagging-threshold: 19.0
gameplay-mechanics:
  mob-last-hurt-by-player-time: 100

4. Performance Profiling with Spark

Instead of legacy Timings, modern 1.21 servers rely on the built-inSparkprofiler. Running/spark sampler --timeout 120generates an interactive CPU flamegraph in your browser to pinpoint any plugin or entity causing TPS drops.

Also read