Direct answer
Give the server enough heap for its real workload while leaving memory for the operating system and native/off-heap use. If you suspect memory pressure, inspect /spark gc, /spark gcmonitor, /spark health --memory, or a heap summary before increasing -Xmx.
More RAM is not automatically faster
Once the server has enough memory, adding more heap gives diminishing returns. CPU-heavy entity AI, chunk generation, redstone, or plugins remain CPU-heavy no matter how large the heap is.
Signs of memory pressure
- Heap repeatedly grows near its limit and drops sharply after GC.
- Long or very frequent GC pauses correlate with tick spikes.
- The OS begins swapping/paging heavily.
- The process is killed by the host/OS because total memory exceeds its limit.
Use spark memory tools
spark can report GC history, monitor GC activity, produce heap summaries, and create full heap dumps. A full heap dump can be large and should be used deliberately; a heap summary is a better first look for most admins.
Leave host headroom
Do not set -Xmx equal to every byte of RAM your machine has. Java also uses native memory outside the heap, and the operating system, file cache, panels/agents, proxies, databases, and other services need RAM.
References
These sources were checked while preparing this article. Performance behavior and configuration can change between Minecraft/server-software versions, so verify version-specific settings before applying them.
Related articles
Help us improve this article
Tell us what is missing, unclear, outdated, or incorrect. You can also suggest something we should add.