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
Admincraft Meta
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
Discount Milk
Discount Milk2y ago
!oom
Carl-bot
Carl-bot2y ago
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
1who¡ssus?
1who¡ssus?2y ago
You really don't need 32gb of ram As the epic guide said A spark report would be helpful as the logs say
Bearikaze
BearikazeOP2y ago
so we just did a heap dump, and it turns out aurelium skills is using 1.1 out of 1.9 gb of ram
1who¡ssus?
1who¡ssus?2y ago
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
Bearikaze
BearikazeOP2y ago
i have a timings report from earlier if that would be helpful
1who¡ssus?
1who¡ssus?2y ago
Meh Timings are weird I prefer spark reports
Bearikaze
BearikazeOP2y ago
how long should we let it run? neither of us have taken a spark report before
1who¡ssus?
1who¡ssus?2y ago
Maybe 10 mins? Have you checked this right?
Bearikaze
BearikazeOP2y ago
i am having trouble finding it. where exactly should it show up?
1who¡ssus?
1who¡ssus?2y ago
If you never had to add startup flags then that flag is not here You're giving enough memory to the container right?
Bearikaze
BearikazeOP2y ago
ya i guess thats not the issue then. were all kinda new to this so....
1who¡ssus?
1who¡ssus?2y ago
I mean Do not use as xmx the whole memory in the container (If you're doing that)
Bearikaze
BearikazeOP2y ago
i dont believe we are. all us noobs cant even find it in the sparked host files
1who¡ssus?
1who¡ssus?2y ago
That's not in the files iirc Ok so I assume your host uses a panel called pterodactyl There's a window called startup
Bearikaze
BearikazeOP2y ago
our panel is apollo actually
1who¡ssus?
1who¡ssus?2y ago
You should check what startup args are there just in case I wanna see an ss of it Out of curiosity
Bearikaze
BearikazeOP2y ago
No description
Bearikaze
BearikazeOP2y ago
No description
1who¡ssus?
1who¡ssus?2y ago
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
Bearikaze
BearikazeOP2y ago
ya we literally just saw that and we are kicking ourselves lmao
1who¡ssus?
1who¡ssus?2y ago
Contact support to change that Btw what's your server jar? Here, some cool JVM flags, you should ask your host to add them
java -Xms128M -Xmx16384M -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 server.jar
java -Xms128M -Xmx16384M -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 server.jar
More memory to Minecraft will make it to perform worse
Bearikaze
BearikazeOP2y ago
do you mean the server minecraft version?
1who¡ssus?
1who¡ssus?2y ago
No, I mean Fabric, bukkit, paper
Bearikaze
BearikazeOP2y ago
oh. paper should have clarified earlier my bad
1who¡ssus?
1who¡ssus?2y ago
Yeah it's good Just wanted to make sure you weren't on spigot
Bearikaze
BearikazeOP2y ago
ah ok
1who¡ssus?
1who¡ssus?2y ago
Oh look at that Want happens if you enable the Akair flags thing Because this is Akair flags And the lower maximum ram thing
Bearikaze
BearikazeOP2y ago
ohhh nice
1who¡ssus?
1who¡ssus?2y ago
You don't need the log4j thing iirc But it should not cause problems
Bearikaze
BearikazeOP2y ago
k we changed those settings and we are restarting to see if its better
1who¡ssus?
1who¡ssus?2y ago
Alright just make sure your host removed alwayspretouch From Akair flags
Bearikaze
BearikazeOP2y ago
ok will do
1who¡ssus?
1who¡ssus?2y ago
The startup command should have changed
QarthO
QarthO2y ago
tbh, u can even go lower than 16gb
1who¡ssus?
1who¡ssus?2y ago
Yup Anything higher than 16 gb will make Minecraft to perform progressively worse
QarthO
QarthO2y ago
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
1who¡ssus?
1who¡ssus?2y ago
As little as possible but not choking
QarthO
QarthO2y ago
^ a happy goto number is 12gb
Bearikaze
BearikazeOP2y ago
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
QarthO
QarthO2y ago
yeah dont use 31gb thats just bad
1who¡ssus?
1who¡ssus?2y ago
They have to contact support to change that
QarthO
QarthO2y ago
👍 well my assumption is they are paying for 32gb host when they dont need to be
1who¡ssus?
1who¡ssus?2y ago
No alwayspretouch so it's gud Except the xmx
QarthO
QarthO2y ago
can also make xms the same as xmx but kind of negligible
Bearikaze
BearikazeOP2y ago
i think the issue was all of our ram being allocated
QarthO
QarthO2y ago
yes, definitely
1who¡ssus?
1who¡ssus?2y ago
I love to set xms as 128M and see the real memory usage of Minecraft with spark
QarthO
QarthO2y ago
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
1who¡ssus?
1who¡ssus?2y ago
Max is 25 players As they've said
QarthO
QarthO2y ago
im teaching a man how to fish, not giving him fish
Bearikaze
BearikazeOP2y ago
ya we have about 30 plugins
QarthO
QarthO2y ago
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
Bearikaze
BearikazeOP2y ago
usually around 20 players max actually, but we are growing stop fightting guys
QarthO
QarthO2y ago
one of the biggest misconception i see people mistake is "more ram = less lag, better server" we're not, we're homies
Bearikaze
BearikazeOP2y ago
lol thanks so much for all the help and advice guys
QarthO
QarthO2y ago
now get out there and have some fun mining 🫡
Bearikaze
BearikazeOP2y ago
sure thing boss
ProGamingDk
ProGamingDk2y ago
Man ain't even using 12 gb+ aikar flags

Did you find this page helpful?