Guide
How much RAM does a Minecraft server need?
Most advice about Minecraft server memory is either too low to be useful or so high it wastes money. This guide uses the figures from the Minecraft Wiki and the Paper documentation, explains what actually fills memory and what causes lag, and ends with how to set the heap so Java does not run your server out of memory. It covers Java Edition servers: vanilla, Paper, and modded.
By Evorxa teamPublished
The short answer
Two sources give two kinds of number. The Minecraft Wiki lists what a vanilla server needs on default settings with a newly generated world. The Paper team recommends what a Paper server should get to run well, whatever the player count.
| Source | Setup | Memory |
|---|---|---|
| Minecraft Wiki, minimum | vanilla, 1 to 4 players | 1 GB |
| Minecraft Wiki, recommended | vanilla, 5 to 10 players | 2 GB |
| Minecraft Wiki, best | vanilla, 10 or more players | 4 GB |
| Paper docs (Aikar's flags) | Paper, any player count | 6 to 10 GB heap |
The wiki figures are a floor for a fresh world. Worlds grow, players spread out, and plugins add their own data, so a public server that runs for months needs more. A practical way to decide:
- Small vanilla or Paper server for friends: 4 GB of server memory covers the wiki's figure for 10 or more players, with about 2.5 to 3 GB given to Java. Paper's team would give it more if you can.
- Paper server with plugins and a growing world: follow the Paper advice and plan for a 6 to 10 GB heap, which means an 8 to 12 GB server.
- Modded server: use the figure the modpack's author publishes. There is no general rule, because one mod can need more than the whole vanilla game.
Paper also warns against the opposite mistake: beyond a certain point more memory brings diminishing returns, and buying 32 GB of RAM for a server mostly wastes money.
What fills the memory
The wiki puts a single player object at about 50 to 100 MB and adds that the server often has to allocate much more per player, because each player keeps an area of the world loaded around them. Growing world size and high view distances increase memory use. On top of that come entities (mobs, items, minecarts), plugin and mod data, and Java's own working space.
Java memory also does not behave like a simple counter. Minecraft creates and discards a huge number of short-lived objects every second, and the garbage collector cleans them up in cycles. The Paper documentation mentions an allocation rate of at least 800 MB per second on a 30-player server. A heap that is too small makes the collector run constantly, and those pauses show up as lag.
Lag is usually the CPU, not the RAM
The game runs its world simulation in ticks, 20 per second. That gives each tick 50 milliseconds. According to the wiki, the server does the majority of this work on one core and uses other cores only for side tasks, so the speed of a single core decides how much it can handle before ticks take longer than 50 ms and the world slows down. Large numbers of mobs and complex redstone are the usual causes.
This is why adding RAM rarely fixes lag on a server that already has enough. If /mspt is high while memory has room to spare, you need a faster core or less work per tick, not more gigabytes. Some plugins move their own work to other cores; the wiki advises reading a plugin's documentation before you install it.
View distance and simulation distance
Two settings in server.properties set how much of the world each player keeps busy. Both are measured in chunks as a radius around the player, both default to 10, and both accept 3 to 32, as listed in the server.properties reference.
view-distanceis how much world data the server sends to the player. It mostly costs memory and bandwidth.simulation-distanceis how far from a player living entities are still updated. It costs CPU on every tick.
The area grows with the square of the radius, so the savings are larger than the numbers suggest: going from 10 to 6 cuts the area to roughly a third. Keeping simulation lower than view distance lets players see far while the server only runs the nearby area:
# server.properties (both default to 10, allowed range 3 to 32)
view-distance=8
simulation-distance=6Heap size versus server memory
The -Xmx value sets the maximum size of Java's heap. It is not the total memory the process uses. Java needs more on top of it for its own structures, threads and buffers, and the operating system needs memory too. If you give the heap everything the server has, the Linux out-of-memory killer can stop the server process without warning.
The Paper documentation gives the rule: set -Xmx and -Xms about 1000 to 1500 MB below the memory you have. With 8 GB, use 6500 MB. Set both to the same value: Paper explains that the server should be expected to use the whole heap anyway, and memory left below -Xmx is unused.
| Server memory | -Xms and -Xmx |
|---|---|
| 4 GB | 2500 to 3000 MB |
| 8 GB | 6500 MB |
| 12 GB | 10500 to 11000 MB |
| 16 GB | 14500 to 15000 MB |
If you do not set -Xmx at all, Java chooses a default based on the system, and in a container it reads the container's memory limit, as the java command reference describes. The default is rarely what you want for a game server, so always set it.
Aikar's flags
Paper publishes a set of garbage collector settings known as Aikar's flags, tuned for Minecraft's allocation pattern. They use the G1 collector, give it a larger young generation so short-lived objects are cleaned up before they are promoted, reserve memory up front with AlwaysPreTouch, and stop plugins from forcing full collections with DisableExplicitGC. Paper needs Java 25 or newer, according to its getting started guide, so check the version first:
# Paper needs Java 25 or newer
java -version# 8 GB server: heap 6500 MB, Aikar's flags (Paper docs)
java -Xms6500M -Xmx6500M -XX:+UseG1GC -XX:+ParallelRefProcEnabled \
-XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions \
-XX:+DisableExplicitGC -XX:+AlwaysPreTouch -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 \
-Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true \
-jar paper.jar --noguiChange only the two memory values to fit your server. Paper's documentation also links a script generator that writes this start script for you. The same page describes -XX:+UseTransparentHugePages as an experiment for advanced users, only together with AlwaysPreTouch, and says the Paper team has not measured its effect on Minecraft. Leave it out unless you plan to measure it yourself.
If you suspect memory trouble, turn on garbage collection logging. Paper notes that it does not hurt performance and the log files stay at about 5 MB:
# add to the java line (Java 11 and newer) to log garbage collection
-Xlog:gc*:logs/gc.log:time,uptime:filecount=5,filesize=1MMeasure before you upgrade
Paper has commands for the two numbers that matter, listed in its command reference:
/tps # ticks per second over 1, 5 and 15 minutes (target 20.0)
/mspt # milliseconds per tick over 5, 10 and 60 seconds (keep under 50)
/spark # Paper's built-in profiler, which supersedes both# total and available memory on the server, in MB
free -m
# resident memory of the Java process, in KB
ps -o pid,rss,args -C java- TPS below 20 and MSPT above 50, memory fine: the CPU is the limit. Lower
simulation-distance, find heavy farms or plugins with/spark, or move to a faster core. - Collections running constantly, or the process killed: the heap is too small or set too close to the server's total memory. Fix the gap first, then add memory.
- Both fine but players report lag: check the network path and the player's own connection before you change the server.
Do not be alarmed when ps shows the Java process using more than -Xmx. That extra is the memory Java needs outside the heap, and it is the reason for the 1000 to 1500 MB gap. With -Xms equal to -Xmx and AlwaysPreTouch on, the process also claims its full heap at start, so a high number right after boot is expected and does not mean a leak. Watch how the number changes over hours of play instead.
Minecraft on Evorxa
Evorxa's Minecraft hosting runs on VPS plans with shared cores and VDS plans with dedicated high-frequency cores; the second kind suits Minecraft's single-thread load. Plans start at $2.99 a month, are prepaid monthly, for six months or yearly, and give you root and SSH access to set the flags above. Servers run in one region, Eygelshoven in the Netherlands, and a plain Linux image is usually ready in about a minute.
Sources
The facts in this guide come from these pages.