Cafora Docs
Performance

JVM & Garbage Collection

Optimize Java Virtual Machine settings for your Cafora server.

The JVM (Java Virtual Machine) runs your Minecraft server. Proper JVM configuration significantly affects performance.

JVM Flags

Configure JVM flags in Startup Parameters.

Aikar flags are the community-standard JVM configuration for Minecraft servers:

java -Xms10G -Xmx10G -XX:+UseG1GC -XX:+ParallelRefProcEnabled
-XX:MaxGCPauseMillis=200 -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

Adjust -Xms and -Xmx to match your plan's RAM allocation. These must be equal.

Garbage Collection

Garbage Collection (GC) reclaims memory that is no longer in use. Poor GC configuration leads to lag spikes.

Aikar flags configure the G1 garbage collector, the best choice for Minecraft servers.

What to Watch For

  • GC pause times: pauses over 200ms cause noticeable lag
  • Full GC events: should be rare; frequent full GCs indicate memory pressure
  • Heap usage pattern: sawtooth pattern is normal; flat line near max means you need more RAM

Monitoring GC

Install Spark and use heap reports to monitor garbage collection:

/spark healthreport

On this page