Consistently high RAM usage. Startup command issue?
I've been running a small Fabric server for me and some friends and have been having a lot of memory issues recently.
I used the servers gamepanel to set up the server initially and after trying a variety of optimization mods, and lowering view distance I'm still struggling to solve the issue.
Today after further research it seems it may be because I don't have additional java arguments set for when the server starts and just have the full 4gb allocated right off the bat.
I'm sure I could trial and error this process but if somehow has some time to hop on a quick voicecall to guide me I would greatly appreciate it.
103 Replies
Thanks for asking your question!
Make sure to provide as much helpful information as possible such as logs/what you tried and what your exact issue is
Make sure to mark solved when issue is solved!!!
/close
!close
!solved
!answered
Requested by tommytimbo#0
use aikars flags and xms
https://flags.sh also helps
I'll give it a go.
Should I be adding them to the "additional java options" section
probably. i'm not entirely familiar with that panel
👍 no problem. will do some testing and report back. this site is very helpful
yep
Where are you seeing the memory usage?
@TommyTimbo
I just stopped the server and with no one online the memory was at 3.09/3.91
It's normal for the panel to report that the server memory is high
Just don't use -xx: alwayspretouch in your startup
Sure thing. Whats the reasoning? I see it being used in most recommended startups
You should get memory usage insights from spark
Alwayspretouch loads (aka pretouches) all pages. This can make the docket container to consider the server is going oom
It's like telling the server to load some stuff in startup instead of loading it while the server is running
Will Spark be useful to me if I don't understand the java classes in the heap dumps?
Do you have lag issues or it's just that you're worried that the panel memory usage is so high?
It's really useful for stuff like seeing if the garbage collections are being done correctly, or what's lagging the server
But afaik heap dumps are hard to read, I think not even leche knows how to debug heapdumps 😅
The other night with 3 people online we ran oom 3 times with a view distance of 8.
If you had alwayspretouch it might have been that
It might ™
I'm unsure if there are even startup flags right now. This panel is annoying
You
He
She
🤭
It's worth removing it
& set Xms to 128M
Oh wow okay, I was going to set the xms to 2000m and the xmx to 2000m as well
Only 2 gb? You guys don't have many mods right?
A few datapacks from Vanilla Tweaks and then optimization plugins
I see.
Plugins? You mean mods?
yes
May I ask why you guys haven't used paper?
Out of curiosity btw
Changes too many vanilla features
Nothing wrong with making a vanilla themed server in fabric it's just that paper has more optimizations
Oh I see
or "bugs" depending how you look at it
As a general optimization tip have you disabled something called sync chunk writes in the server.properties?
Disabling that is suggested
Because having it on true gives perf issues or slow chunk loading
It is set to true currently. What is the downside to turning it off
I'm a bit confused you said 128M for xms and i said 2000M and then you inquired why only 2gb
None tbh
2000mb is aprox 2gb
right right so why set it to 128m
There's more downs than ups
Well
There's not lots of diff really
When xms is at a low value, the Minecraft process will only allocate the amount of memory it needs & not all of the xmx. This is generally how everyone configures these flags
& the rest is reserved
You should be able to alocate 3250MB
At xmx
Ahhhhh, gotcha.
A thread i was reading said to split it down the middle 2000M 2000M and said that the XMX is how much it "climbs by"
Uh I don't think it works like that?
^ don't try 3500 idk if your host gives overhead
Enviro does
Alright I'm going to slap this bad boy in
#!/bin/bash
java -Xms128M -Xmx3250M --add-modules=jdk.incubator.vector -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -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 -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -jar fabric.jar --nogui
The bin Bash is not needed
That's used if you have got the startup in an sh file
If you have spark you can run /spark health
And see stuff like tps and memory usage
I may be blind I don't see a bin bash
ooops top line
is the --nogui line needed? i don't really understand it
Nah
Nogui & the bin/bash is not needed
Server unable to run
Did you changed the jar name in the flags?
Look at the end it is calling to fabric.jar
Make sure they've got the same name
it is. is 128M enough to start the server?
Give me a sec
java -Xms128M -Xmx3250M --add-modules=jdk.incubator.vector -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -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 fabric.jar
Aikar's Thoughts
JVM Tuning: Optimized G1GC for Minecraft - Aikar's Thoughts
Learn more about my In depth study on tuning the G1GC garbage collector to be optimized for how Minecraft servers run, and keep low pause efficient usage.
These flags are from the Akair docs
Try these
Still a no go. Here's the crash log
Please use a paste service instead!
Paste services are more mobile friendly and easier to read than just posting a log file
message.txt
Requested by tommytimbo#0
Try a lower xmx
2500M
No go
.. hmm
Well try to use no flags.
Just the
java -Xms128M -Xmx2500M -jar fabric.jar
For testing
The server is shutting down with no crash report or whatsoever lol
Does the panel says anything?
17:44:59
Error: Could not find or load main class java
Caused by: java.lang.ClassNotFoundException: java
Even with these?
Yes
Would you be down to hop on a call? i understand if not
I'm sorry, I am not native English;-;
no worries friend
I think you should ask your host?
Maybe
Something happened to their java docker?
the additional java options section is where i have been adding them. I have also been changing the memory limit the what the xmx is
Prior to this I had the memory limit at 4000M and nothing in the additional java options section
Ohh
Wait a second
I'm not used to this panel at all. Much more difficult than things were 10years ago
It's a weird panel I prefer ptero
amp is interesting
it has some cool features tho
Does amp (your panel) has a different place to type in the server jar?
Like maybe in the additional java options thing we're not supposed to type xmx and such
I've been going through each menu and do not see anywhere else
Just out of curiosity do you know how does amp knows the name of the server jar?
Ahhh
Alright try this
Wh
Eh
Wrong paste
-Xms128M -Xmx3250M --add-modules=jdk.incubator.vector -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -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
Aikar's Thoughts
JVM Tuning: Optimized G1GC for Minecraft - Aikar's Thoughts
Learn more about my In depth study on tuning the G1GC garbage collector to be optimized for how Minecraft servers run, and keep low pause efficient usage.
If it still fails remove xmx.
@ProGamingDK can you confirm me if the maximum heap size is xmx?
xmx is maximum ram allowed for the jvm to use
That one booted up. What did you change
although jvm overhead goes over xmx
Ahh
I removed the -jar fabric.jsr
What does JVM mean?
Because the panel already does that
Java Virtual machine
Java virtual machine
Java virtual machine?
lol
Jynx
yes
Okay so it looks like the server is using about .8GB less than it was before with 1 person on. will have to test with more people later
8 GB less? Doesn't the panel have only 4 gb?
An .8
Woah
I have some good reading skills
Ay about the spark thing
It is a mod
!spark
Spark Profiler
Spark can be used to see why your server or client is lagging.
https://spark.lucko.me/
Admincraft Canned Responses
You can dl it here
before i go. final question. Is it okay to have the "Memory Limit" set to 4000mb and then in the "additional java options" to have the xmx set to 3250m?
Memory limit is the thing at here?
yes
I guess yeah. I'm pretty sure memory limit just makes sure the overhead doesn't go over 4 gb
kk
I will do more research into spark and get it set up.
One issue i havewith this panel is when i manually edit the server.properties it overwrites it on server start
so the sync-chunk-writes is back to true for some reason
Can you disable it as an option in..
Here?
I've looked before and done google searches and can not find antyhing
Found the option i believe
Tada
It's that
would be nice to be able to just change the file manually but i guess this is easier for some
Some never worked on a cli or a text Editor
@ProGamingDK sorry for pinging do you think this might be correct? I mean it says memory limit so yeah
memory most likely is literally just xmx
Yeah I've thought on that too
Even with this setting turned off the sync-chunk-writes is still set to true
very odd
Try to refresh
I did multiple times 😐
ask in their support ig
Will do. Thanks a bunch y'all!
Glad to have helped
^^
You can change it manaually but the changes have to be imported