Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/obydux/minecraft-graalvm-flags
Minecraft server startup flags for GraalVM
https://github.com/obydux/minecraft-graalvm-flags
graalvm graalvm-flags java java-flags jvm-flags minecraft minecraft-flags minecraft-graalvm minecraft-server
Last synced: 5 days ago
JSON representation
Minecraft server startup flags for GraalVM
- Host: GitHub
- URL: https://github.com/obydux/minecraft-graalvm-flags
- Owner: Obydux
- Created: 2020-07-23T16:31:34.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-08-26T20:09:28.000Z (5 months ago)
- Last Synced: 2024-12-31T00:09:34.759Z (12 days ago)
- Topics: graalvm, graalvm-flags, java, java-flags, jvm-flags, minecraft, minecraft-flags, minecraft-graalvm, minecraft-server
- Homepage:
- Size: 72.3 KB
- Stars: 110
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
[![](https://img.shields.io/discord/1263839827661557801)](https://discord.gg/MC2BzcE3vx)
[![](https://img.shields.io/github/sponsors/Obydux)](https://github.com/sponsors/Obydux)Information
======These Java flags are meant for Minecraft servers ran with the GraalVM Java Runtime which you can download from [here](https://www.graalvm.org/downloads/). They only work on Java 17 and higher and **they only run on Linux**.
### NOTE: These flags were just put together based on a few sources without proper testing on the actual performance impact. Most of these flags aren't GraalVM specific either. For a more sane way of optimizing the Java GC please read [this](https://obydux.github.io/Minecraft-startup-flags/).GraalVM Java Flags
======```--add-modules=jdk.incubator.vector -XX:+UseG1GC -XX:MaxGCPauseMillis=130 -XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=28 -XX:G1HeapRegionSize=16M -XX:G1ReservePercent=20 -XX:G1MixedGCCountTarget=3 -XX:InitiatingHeapOccupancyPercent=10 -XX:G1MixedGCLiveThresholdPercent=90 -XX:SurvivorRatio=32 -XX:MaxTenuringThreshold=1 -XX:+PerfDisableSharedMem -XX:G1SATBBufferEnqueueingThresholdPercent=30 -XX:G1ConcMarkStepDurationMillis=5 -XX:G1ConcRSHotCardLimit=16 -XX:G1ConcRefinementServiceIntervalMillis=150 -XX:G1RSetUpdatingPauseTimePercent=0 -XX:+UseNUMA -XX:-DontCompileHugeMethods -XX:MaxNodeLimit=240000 -XX:NodeLimitFudgeFactor=8000 -XX:ReservedCodeCacheSize=400M -XX:NonNMethodCodeHeapSize=12M -XX:ProfiledCodeHeapSize=194M -XX:NonProfiledCodeHeapSize=194M -XX:NmethodSweepActivity=1 -XX:+UseFastUnorderedTimeStamps -XX:+UseCriticalJavaThreadPriority -XX:AllocatePrefetchStyle=3 -XX:+AlwaysActAsServerClassMachine -XX:+UseTransparentHugePages -XX:LargePageSizeInBytes=2M -XX:+UseLargePages -XX:+EagerJVMCI -Dgraal.TuneInlinerExploration=1 -Dgraal.LoopRotation=true -Dgraal.OptWriteMotion=true -Dgraal.CompilerConfiguration=enterprise```
Hosting
======I highly recommend BisectHosting for your server needs. They have 20 server locations, advanced DDoS protection and an user-friendly panel for server management. Use code **OBYDUX** to get 25% off!
Flag Explanations
======- `--add-modules=jdk.incubator.vector` This is only useful for servers running Pufferfish or Purpur on 1.18.2 and above. It enables SIMD operations on your server if they're available and optimizes map rendering.
- `-XX:+UseG1GC -XX:MaxGCPauseMillis=130 -XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=28 -XX:G1HeapRegionSize=16M -XX:G1ReservePercent=20 -XX:G1MixedGCCountTarget=3 -XX:InitiatingHeapOccupancyPercent=10 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=0 -XX:SurvivorRatio=32 -XX:MaxTenuringThreshold=1 -XX:+PerfDisableSharedMem` Generic G1GC flags. These flags are very close to [Aikar's](https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/).
- `-XX:G1SATBBufferEnqueueingThresholdPercent=30 -XX:G1ConcMarkStepDurationMillis=5 -XX:G1ConcRSHotCardLimit=16 -XX:G1ConcRefinementServiceIntervalMillis=150` Optimizes G1GC's concurrent collection threads, the last 2 flags aren't needed in Java 21 anymore.
- `-XX:G1RSetUpdatingPauseTimePercent=0` Makes all the work to be done in the G1GC concurrent threads, not the pauses.
- `-XX:+UseNUMA` Enables optimizations for multisocket systems, if applicable. Not sure if this applies to MCM CPUs like Ryzen or Epyc, but its auto disabled if not applicable.
- `-XX:-DontCompileHugeMethods` Allows huge methods to be compiled.
- `-XX:MaxNodeLimit=240000 -XX:NodeLimitFudgeFactor=8000` Enable optimization of larger methods.
- `-XX:ReservedCodeCacheSize=400M -XX:NonNMethodCodeHeapSize=12M -XX:ProfiledCodeHeapSize=194M -XX:NonProfiledCodeHeapSize=194M` Reserves more space for compiled code. All sections must "add up" to `ReservedCodeCacheSize`.
- `-XX:NmethodSweepActivity=1` (default 10) Keeps "cold" code in the cache for a longer time. There is no risk of "filling up" the code cache either, as cold code is more aggressively removed as it fills up.
- `-XX:+UseFastUnorderedTimeStamps` Avoids system calls for getting the time. The impact of this will vary per system, but we aren't really concerned with logging timestamp accuracy.
- `-XX:+UseCriticalJavaThreadPriority` Nothing should preempt the Minecraft threads. GC and Compiler threads can wait.
- `-XX:AllocatePrefetchStyle=3` Generate one prefetch instruction per cache line. More aggressive prefetching is generally useful on newer CPUs with large caches.
- `-XX:+UseTransparentHugePages -XX:LargePageSizeInBytes=2M -XX:+UseLargePages` Enables [Large Pages](https://kstefanj.github.io/2021/05/19/large-pages-and-java.html).
- `-XX:+EagerJVMCI` Eagers the JVMCI Compiler provided by GraalVM.
- `-Dgraal.TuneInlinerExploration=1 -Dgraal.LoopRotation=true -Dgraal.OptWriteMotion=true -Dgraal.CompilerConfiguration=enterprise` Generic GraalVM flags.Sources
======- Updated Aikar flags: https://github.com/etil2jz/etil-minecraft-flags
- Red Hat's optimization guide: https://www.redhat.com/en/blog/optimizing-rhel-8-run-java-implementation-minecraft-server
- BruceTheMoose's Java flags benchmarks: https://github.com/brucethemoose/Minecraft-Performance-Flags-Benchmarks