Server Soaking up RAM


#1

Hey Guys,

Has anyone experienced this issue?

I have a Skyfactory server running and have 10G of RAM allocated to it. There are 4 players on the server as its whitelisted. Every few days I check the Wed UI and it shows the server using nearly 11G of RAM, even though at any one time there may be 2 or 3 players on.

When i stop and restart the server it comes back down to 6G. But always climbs back up.

Any thoughts?


#2

Minecraft, when allocated memory, doesn’t ever unload/free memory unless it needs to.

Regardless of whether there are 10 players on–or 2. Basically, when you allocate 10GB to Minecraft, it says “I will do my best to load all the active areas for any logged-in players. I won’t unload any areas (even if you leave them) unless I run low on free memory.”

This is an intended behavior, and something we should expect/be happy with. Minecraft holding 10GB of RAM doesn’t mean it runs slower than if it released down to 6GB…in fact the opposite; if it unloaded areas just for the sake of unloading them, then it would have to load it again later.

Free memory doesn’t help performance in any way; being out of memory is a different thing, but typically until you see your swap file increase, Minecraft being greedy is a good thing. (and if the swap file does end up getting used, it means you need to allocate less to Minecraft because it’s over-allocated.


#3

Thats interesting. Thanks for that! Quick question… Whats the swap file?


#4

When your server runs out of RAM, instead of just outright crashing, it decides to start using storage space (your hard drive) as RAM with the memory it thinks it needs least.

This is slow, slow, slow, and will cripple performance; you never actually want Linux to fallback to using your HDD for RAM, but it does it in hopes that memory can get cleared out and not have to crash/restart everything.