Setup for Minecraft Java Arguments

OS Name/Version: Windows Server 2022

Product Name/Version: Decadeus

Problem Description: We updated the OS and AMP, then did the usual MC instance setup with Aikar’s flags (reference). Testing on my pc at home (just a regular paper server setup, no AMP) the -Xms value allocates the full 10G. Once I remote upload everything to AMP, it doesn’t seem to allocate the full 10gb as the minimum. Pretty sure I am doing something wrong or missed a simple setting etc. One other difference is the home pc is on Java HotSpot 64-Bit Server VM build 19+36-2238

^ Top shows Essentials readout on my pc at home. Below that you can see the difference on the server with AMP. Then I added in some relevant info under that.

Below are the flags I use on the home pc for reference

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 -Dusing.aikars.flags= -jar paperclip.jar --nogui

Below are the “Additional java options” I use in AMP. Basically the same with a couple things removed from the start/end that I was told previously are handled by AMP

-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 -Dusing.aikars.flags=

Steps to reproduce:

  • updated OS and AMP
  • usual mc instance setup
  • use Aikar’s Java Startup flags
  • Xms value is not effecting allocated memory

Actions taken to resolve so far:

Just some searching here on the forum. I did try formatting the values like this -Xms10240M because I saw others doing it that way instead of -Xms10G. Pretty sure I am doing something wrong here so any help is much appreciated! Keep up the good work!

Remove Xms, Xmx, Jar, and nogui, as AMP adds those

1 Like

Ahh perfect! Would you happen to know how to adjust the minimum (Xms) value in the AMP panel? I have the maximum heap size set in the Java and Memory tab as shown in the pic already.

I am having the same issue and would really like to know how to set up the minimum (Xms) value via AMP.

You don’t really need the Xms value, but you should be able to manually add the arg, you’d just need to remember to update it if you change the memory value.

1 Like

Sounds good, where should I manually add the arg? Just putting -Xms10G in the “Additional java options” under the “Java and Memory” tab does not seem to have any effect. I really appreciate the info!

I have been searching for the answer to this question as well and have tested on multiple different Java versions/minecraft servers. Looking forward to a resolution!

It would just be under Java and Memory yeah. I’ve found that the Xms arg doesn’t do much at all, so it’s most likely been applied properly, just with no effect.

@Mike any ideas on how to change the -Xms value? I’m no expert on the subject, just a guy setting up an MC server hahaha.

explanation from Aikar:

G1 operates better with the more memory it’s given. G1 adaptively chooses how much memory to give to each region to optimize pause time. If you have more memory than it needs to reach an optimal pause time, G1 will simply push that extra into the old generation, and it will not hurt you The fundamental idea of improving GC behavior is to ensure short-lived objects die young and never get promoted. With the more memory G1 has, the better assurance you will get that objects are not getting prematurely promoted to the old generation. G1 Operates differently than previous collectors and is able to handle larger heaps more efficiently.
If it does not need the memory given to it, it will not use it. The entire engine operates differently and does not suffer from too large of heaps, and this is industry-wide accepted information that under G1 to keep Xms and Xmx the same!

I’d suggest checking the Support and Updates tab to see if Xms is being applied to the startup command

1 Like

Nope, original post already has a pic of the support and updates tab. AMP shows the -Xmx setting but nothing about -Xms. Is there anyone I can email within Cubecoders to take a look and tell me how to set it up properly?

What about after you removed Xmx from the args?

“Additional Java Flags” in the configuration.

I have the same problem and what you said isn’t exactly working @Mike, unless I’m doing it in the wrong place.

I’m using those as Additional Java options (MinecraftModule.Java.CustomOpts):

-Xmx15360M -Xms15360M -XX:+UseG1GC

Memory Limit (MinecraftModule.Java.MaxHeapSizeMB) is also configured to be 15360

But only the following JVM arguments are being applied (from Last Arguments):

-Xmx15360M -XX:+UseG1GC

It appears that custom memory configurations in Additional Java options are being suppressed (I believe Xmx is coming directly from Memory limit instead of the additional options)

Hey @Mike ! Any update on this? Sorry for the ping, just want to know if the issue could be related to some config or has to do with AMP itself

CustomOpts is something different. You want the one specifically called “Additional Java Options” in AMP. Use the search box and search for “Additional” to find it.

@Mike I believe it’s the same thing we did. Additional Java Options is referenced here as MinecraftModule.Java.CustomOpts. Look:

Additional Server Arguments would be MinecraftModule.Minecraft.AdditionalOpts:

Last arguments show the memory flag as configured by Memory limit, ignoring Additional Java Options:

Our issue is that -Xms is not applied at all, and there’s no “initial memory” configuration for setting it. -Xmx is also replaced by whatever’s configured at Memory limit, so I believe both memory flags are being removed before that. Unless we’re supposed to add memory configurations to the Additional Server Arguments?

Don’t put any flags in there that AMP already adds itself since it will remove them. I think xms is also a flag it removes, I’ll have to check.

Sure! If that’s the case, is there any other way we can set it?

I’ve checked, there’s no restriction on the behaviour of AdditionalOpts - so putting -Xms XXXXM in should be all that’s required. The flags shown in AMP won’t be reflected until you restart the server. In the case of Forge it’ll appear fairly early on in the string.