The maximum RAM dilemma
Hello, In the past years of running my minecraft server I have heard many oppinions regarding the maximum amount of RAM that a server can use.
Some say 16GB is the most RAM you can add without breaking or not being used, some say 32GB and some say you can add as much as you want without any limitation and it will all be used when needed.
I would like to ask for oppinions in order to clarify this aspect
9 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 real_vgi#0


Right so:
Realistically you should really only allocate 12GB of ram to your server.
This is why:
- most servers don’t need beyond that
- Java’s GC tends to struggle after 12GB of allocates ram. This causes performance issues.
If you’re using pterodactyl (or a host that uses it, or if you use docker), you should consider getting a 14gb server / plan, but allocate 12GB in your flags as docker tends to use 1/2gb more than it’s told to
the more ram allocated to heap, the more java tries to use, the more there is to then garbage collect which is slow, depending on the garbage collector
Would the server still need only 12 Gb if it had, let's say, 400 people in the same time?
!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
second section is the general rule of thumb