Skip to content

Instantly share code, notes, and snippets.

@joshrpg
Last active December 11, 2021 01:04
Show Gist options
  • Save joshrpg/15fb1b7e0f2b61b3d6828d3d49a47c10 to your computer and use it in GitHub Desktop.
Save joshrpg/15fb1b7e0f2b61b3d6828d3d49a47c10 to your computer and use it in GitHub Desktop.
Use the below command line options to get better performance in Minecraft garbage collection. These options go between "java -Xmx<size_in_gb>g -Xms<size_in_gb>g" and "jar <minecraft jar>.jar"
For example, in java 14 the full command would look like this:
java -Xmx8g -Xms8g -XX:+UnlockExperimentalVMOptions -XX:+UseZGC jar minecraft_server.jar
Java 8-14:
-Dterminal.jline=false -Dterminal.ansi=true -Dlog4j2.formatMsgNoLookups=true -XX:+UseG1GC -Dsun.rmi.dgc.server.gcInterval=2147483646 -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M
Java 16/17:
-Dterminal.jline=false -Dterminal.ansi=true -Dlog4j2.formatMsgNoLookups=true -XX:+UnlockExperimentalVMOptions -XX:+UseZGC -XX:+ZProactive -XX:ZCollectionInterval=600 -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:+ParallelRefProcEnabled -XX:+PerfDisableSharedMem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment