Crashing from maxing out RAM
We recently switched from pebblehost with 16gb ram to sparked with 32gb. We are experiencing random crashes, which seem to be caused by all the ram being used. We have anywhere from 5 to 25 people online, but it doesnt seem to make much difference. Theres 5 people online and its using 27gb right now. I am wondering if we actually have too much ram? or if a plugin is leaking it. we have around 26 plugins installed, the heaviest one being Aurelium skills.
60 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 bearik9#0
!oom
My server is using too much memory
My panel says my memory usage is high all the time.
Your server runs in the Java Virtual Machine (JVM), which has significant overhead & tries to effectively use ALL of the memory assigned to it.
Memory usage from "htop", Task Manager, or your server panel is the total consumption of the JVM, not just your server.
My server is lagging & I think it's memory related.
It's much more likely that you are bottlenecked by your CPU, disk, or some inefficient mod/plugin.
Rule of thumb, servers should have anywhere from 4GB to 12GB of memory, with 8GB being the 'sweet spot'.
If you're heavily modded, add 4GB to that.
Too much memory can be a bad thing. Don't exceed these caps unless you really know why you're doing it.
Troubleshoot your server the right way: use Spark & send us a report.
My server is randomly terminated unexpectedly.
Setting your server to use 8GB does not mean that Java won't exceed this amount.
As a rule of thumb, allow your system/container about 1-2GB (possibly more) overhead outside of the server.
If you're on Linux & can SSH into the system, check your kernel logs. They will report any incidents of OOM.
I want to use swap to allocate more memory.
Don't. Swap is not free memory and using it can negatively impact performance.
Admincraft Canned Responses
You really don't need 32gb of ram
As the epic guide said
A spark report would be helpful as the logs say
so we just did a heap dump, and it turns out aurelium skills is using 1.1 out of 1.9 gb of ram
If your java startup flags use -xx: alwayspretouch, then that could™ be what's making the server go oom
So make sure you don't have that if you're using any
i have a timings report from earlier if that would be helpful
Meh
Timings are weird
I prefer spark reports
how long should we let it run?
neither of us have taken a spark report before
Maybe 10 mins?
Have you checked this right?
i am having trouble finding it. where exactly should it show up?
If you never had to add startup flags then that flag is not here
You're giving enough memory to the container right?
ya i guess thats not the issue then.
were all kinda new to this so....
I mean
Do not use as xmx the whole memory in the container
(If you're doing that)
i dont believe we are. all us noobs cant even find it
in the sparked host files
That's not in the files iirc
Ok so I assume your host uses a panel called pterodactyl
There's a window called startup
our panel is apollo actually
You should check what startup args are there just in case
I wanna see an ss of it
Out of curiosity
It looks like ptero but with some changes
Idk why your host uses max memory of the container by default
Unless they're giving swap overhead
Anyways xmx should never be higher than 16 gb
ya we literally just saw that and we are kicking ourselves lmao
Contact support to change that
Btw what's your server jar?
Here, some cool JVM flags, you should ask your host to add them
More memory to Minecraft will make it to perform worse
do you mean the server minecraft version?
No, I mean
Fabric, bukkit, paper
oh.
paper
should have clarified earlier my bad
Yeah it's good
Just wanted to make sure you weren't on spigot
ah ok
Oh look at that
Want happens if you enable the Akair flags thing
Because this is Akair flags
And the lower maximum ram thing
ohhh nice
You don't need the log4j thing iirc
But it should not cause problems
k we changed those settings and we are restarting to see if its better
Alright just make sure your host removed alwayspretouch
From Akair flags
ok will do
The startup command should have changed
tbh, u can even go lower than 16gb
Yup
Anything higher than 16 gb will make Minecraft to perform progressively worse
if u allocate 100gb, minecraft server will say it'll use like 90gb... if allocate 10, it'll use like 9. its a bit more complicated, but ideally, ur goal, is to use a LITTLE memory as possible
As little as possible but not choking
^
a happy goto number is 12gb
heres our startup command
java -Xms128M -Xmx31744M -Dterminal.jline=false -Dterminal.ansi=true -Dlog4j2.formatMsgNoLookups=true -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 -Daikars.new.flags=true -jar server.jar
yeah dont use 31gb
thats just bad
They have to contact support to change that
👍
well my assumption is they are paying for 32gb host
when they dont need to be
No alwayspretouch so it's gud
Except the xmx
can also make xms the same as xmx
but kind of negligible
i think the issue was all of our ram being allocated
yes, definitely
I love to set xms as 128M and see the real memory usage of Minecraft with spark
pay for 16gb host -> allocate 12gb is like ur sweet spot
obv, can and should go lower if u got only few peeps/plugins
higher if u got tons (like 100s) of peeps/plugins
Max is 25 players
As they've said
im teaching a man how to fish, not giving him fish
ya we have about 30 plugins
seems like his answer has already been solved, hes gonna contact his host and lower, now im explaining so in the future he has a better general idea as to why
usually around 20 players max actually, but we are growing
stop fightting guys
one of the biggest misconception i see people mistake is "more ram = less lag, better server"
we're not, we're homies
lol
thanks so much for all the help and advice guys
now get out there and have some fun mining 🫡
sure thing boss
Man ain't even using 12 gb+ aikar flags