What's the ideal permsize Minecraft?

1.7K    Asked by AmeliaArnold in Java , Asked on Oct 6, 2022

I have a FTB Unleashed 1.1.7 server running and I have been getting the following error as of lately "java.lang.OutOfMemoryError: PermGen space".


According to this thread: Dealing with “java.lang.OutOfMemoryError: PermGen space” error , the recommended flags are


-XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled along with setting the MaxPermSize -XX:MaxPermSize=128M.


What is the ideal MaxPermSize? Will increasing the MaxPermSize (256

Answered by Amit jaisawal

While I do agree to some point with the existing answers, increasing to -XX:MaxPermSize=512M will help and even up to -XX:MaxPermSize=1G should not hurt, assuming your server has that amount of physical RAM, a word of advice regarding the total heap size, which is configured by increasing -Xmx=xGB.


In general this will increase the available memory for the program, which is good, since the JVM (Java Virtual Machine, essentially the program running your minecraft server) will have more memory to put 'stuff' into. At a certain point, there will however be a great drawback. As you go into the 10s of gigabytes, the JVM becomes more and more inefficient to handle this much memory without advice.

As more and more memory is needed, you need to tell the JVM what exactly the memory is primarily used for (this depends whether your java objects are rather short- or long-lived). I am not sure regarding how permsize Minecraft handles this memory, as I come from another java field (J2EE), but the bigger the total RAM, the more likely you need to tune your server to the specific requirement for the application.

Specifically you will need to tune the garbage collector to rather have minimal stop-the-world pauses (basically where your server completely stands still and seemingly does nothing). Using -XX:+UseConcMarkSweepGC will help that a lot. Using -XX:CMSClassUnloadingEnabled will only help to keep your PermGen (-XX:MaxPermSize) clean but not keeping your overall heap clean. For the former case, there are literally dozens of settings that need to be considered.

TL;DR:

For a very big server there is a lot more to tune than just the -XX:MaxPermSize. A PermSize of around -XX:MaxPermSize=1G and a heap around -Xmx=4G to -Xmx=6G should still be fairly safe. I would not go much beyond this to keep server performance.

Of course the MaxPermSize + Xmx should never be higher than the RAM installed in your computer. It will start swapping which will reduce performance by some magnitudes.



Your Answer

Interviews

Parent Categories