Optimized jvm flags for paper.
authorLuke Hoersten <luke@hoersten.org>
Wed, 01 Jul 2020 15:47:58 -0500
changeset 108 f00f45a9512d
parent 107 9057b9f9ced8
child 109 646e4b395cc8
Optimized jvm flags for paper.
papermc/templates/papermc.service.j2
--- a/papermc/templates/papermc.service.j2	Wed Jul 01 14:51:38 2020 -0500
+++ b/papermc/templates/papermc.service.j2	Wed Jul 01 15:47:58 2020 -0500
@@ -11,7 +11,9 @@
 WorkingDirectory={{papermc_dir}}
 Restart=on-failure
 RestartSec=20 5
-ExecStart=/usr/bin/java -Xms{{papermc_mem}} -Xmx{{papermc_mem}} -jar server.jar
+# ExecStart=/usr/bin/java -Xms{{papermc_mem}} -Xmx{{papermc_mem}} -jar server.jar
+# Optimizations from https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/
+ExecStart=/usr/bin/java -Xms{{papermc_mem}} -Xmx{{papermc_mem}} -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 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar server.jar nogui
 
 PrivateTmp=true
 ProtectSystem=full