The short answer
What Paper's documentation says:
| Topic | Paper's advice |
|---|---|
| Getting-started command | -Xms4G -Xmx4G |
| Aikar's flags page | At least 6–10 GB no matter how few players; if you can't afford 10 GB, give what you can but leave the OS some memory |
| Headroom for the OS | -Xmx 1000–1500 MB below what the machine or plan has: with 8 GB, about 6500 MB |
| Xms and Xmx | The same value |
| More isn't always better | Minimal returns past a certain point; 32 GB for a server mostly wastes money |
Paper's docs have no “20 players = 4 GB” table, and that's honest: two servers with the same player count can differ a lot in memory use because of view distance, farms, plugins and how far apart players roam. So below is what drives memory use and how to measure it.
What uses memory
- Loaded chunks. The server keeps the world around each player in memory.
view-distance(default 10) sets how many chunks in each direction it sends the client,simulation-distance(also 10) how far out it updates entities. Players spread across the map keep more chunks loaded than a crowd at spawn. - World generation. When players head into unexplored land, chunks are generated on the fly — load on both memory and CPU. Pre-generating the world takes that off the table.
- Entities and machines. Mobs, dropped items, farms, redstone.
- Plugins. Caches, web maps, databases, holograms. One badly behaved plugin can hold more memory than the whole world.
- Allocation rate. Per Paper's docs, Minecraft allocates memory extremely fast — at least 800 MB per second on a 30-player server, mostly short-lived objects. The garbage collector needs room to clear them without extra pauses.
Xms and Xmx: set them equal
-Xmx is Java's memory ceiling (the heap), -Xms is what it gets at start. Paper's docs ask you to set them equal: the server should be expected to use all of -Xmx anyway, and if -Xms is lower, the difference is just unused memory. The G1 collector works better the more memory it has.
java -Xms6500M -Xmx6500M -jar paper.jar --noguiThe key rule: -Xmx has to fit into real memory with room to spare. The Java process uses a bit more than -Xmx — the JVM itself, its threads and buffers need memory too. If the total hits the machine's or container's limit, the system kills the process (the OOM killer), and anything unsaved is lost.
Aikar's flags: do you need them?
Aikar's flags are a set of G1 garbage collector settings tuned for Minecraft's workload. Paper's start script generator currently advises: on a modern JVM (17, 21 or higher), try with no flags first — it handles things well on its own. If you run into GC problems, or you're on an older Minecraft or Java version, use Aikar's flags.
java -Xms10G -Xmx10G -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 --noguiWhy more memory isn't better
Too little memory hurts: the garbage collector runs too often, ticks slow down, and at worst the server crashes with OutOfMemoryError. But extra memory doesn't speed the server up either: Paper's docs say plainly that past a certain point you hit diminishing returns.
The real danger is giving Java everything there is: then the server dies not from a full heap but because the system kills its process. Hence the 1000–1500 MB headroom rule — or a host that adds that headroom on top of the plan.
And memory isn't the only resource. Lag usually comes from the main thread: when a tick takes longer than 50 ms, TPS drops below 20, and more gigabytes won't help. Finding the cause: why a Minecraft server lags. What to look for in hardware: hosting or VPS.
How to see real memory use
Your host's panel meter tells you little: the Java process takes all the memory it's given and doesn't return it to the OS — per Paper's docs that's normal and not a leak. What you want to watch is the heap and garbage collection. Paper bundles the spark profiler since 1.21 for exactly this:
| Command | What it shows |
|---|---|
/spark health | TPS, CPU, memory and disk; the report in the viewer refreshes every 10 seconds |
/spark health show --memory | The same in the console, with extra detail on JVM memory |
/spark gc | The server's garbage collection history |
/spark heapsummary | A heap summary: which objects take memory — how you find a memory-hungry plugin |
/spark profiler start --timeout 600 | After 10 minutes, a report of what's taking up the tick |
How to read it: heap usage normally moves in a sawtooth — it climbs and drops after each collection. Warning signs: the low points of the sawtooth creep up towards -Xmx over time, collections get more and more frequent, OutOfMemoryError shows up in the log. Then find the culprit with /spark heapsummary first, and only then add memory.
If you suspect the garbage collector, turn on GC logging: per Paper's docs it doesn't hurt performance and takes about 5 MB. On Java 11 and newer, add this flag to the start command:
-Xlog:gc*:logs/gc.log:time,uptime:filecount=5,filesize=1MHow to use less memory
- Lower
view-distanceandsimulation-distancein server.properties — the biggest lever you have. - Pre-generate the world and cap its size so the server isn't generating chunks during play.
- Use
/spark heapsummaryand the profiler to find the plugin holding the most — update, reconfigure or replace it. - Rein in farms and mob crowds with rules or server settings.
Check your anticheat too: it processes every packet from every player. DGuard's checks run in network threads, not the server's main thread, so TPS stays at 20: on a live server that's 0.03 % of one core on the main thread — 0.38 ms of a 10.9 ms tick with 121 players. /dguard perf shows the check time on your own server; more in anticheat performance.
FAQ
How much RAM does a Minecraft server need for 10–20 players?
Paper's docs start at 4 GB, and their Aikar's flags page recommends 6–10 GB no matter how few players. The exact amount depends on view distance, plugins and the world — check real usage with /spark health under your actual player count.
Should Xms be the same as Xmx?
Yes, Paper's docs recommend it: the server should be expected to use all of Xmx anyway, and memory between Xms and Xmx just sits unused.
Why does my server use all the memory I give it?
That's how Java works: the heap grows to the allocated size, and the garbage collector rarely returns memory to the OS. Per Paper's docs it's normal as long as you don't see OutOfMemoryError crashes or long GC pauses.
What happens if I allocate too much RAM?
The server won't get faster: past a certain point the gains are minimal. And if you don't leave the OS 1000–1500 MB, the system itself may kill the Java process when memory runs out.
Do I need Aikar's flags on Java 21?
Not necessarily. Paper advises trying a modern JVM (17, 21 or higher) without flags first and switching to Aikar's flags if you run into garbage collection problems.
Sources
- Paper: Aikar's flags
- Paper: Start script generator
- Paper: Getting started
- Paper: Basic troubleshooting — High RAM usage
- Paper: Profiling
- spark: command usage
- Minecraft Wiki: server.properties
- DGuard, the best anticheat for a modern Minecraft server: checks compared with GrimAC, Vulcan, Polar, Intave and Matrix
- DGuard: installation, requirements and troubleshooting
- DGuard: supported Paper and Leaf versions