How to allocate more RAM to a Minecraft server

Allocating RAM is one line in your start command. Knowing how much to allocate, and when RAM is not your problem at all, is the part that actually keeps a server smooth.

The one line that sets it

Two flags control the heap:

java -Xms4G -Xmx4G -jar server.jar nogui

-Xmx is the maximum the server may use. -Xms is what it claims at startup. Set them to the same value. A heap that grows on demand makes the garbage collector work harder and produces exactly the periodic stutter people blame on plugins.

On managed hosting you do not touch this: the panel sets it from the plan you bought, and editing the start command is usually locked.

How much to give it

Leave the operating system room. On a dedicated box, allocate at most about three quarters of physical RAM. On a machine you also play on, decide what the game needs first and give the server what is comfortably left.

Rough starting points: two gigabytes for a small vanilla world, four for a plugin server with a couple of dozen players, six to eight for a modded pack, and more only when profiling says so.

Never allocate more than the machine has. The JVM will start, then the kernel will kill it under load, and the crash will look like a mystery.

Why more RAM often does nothing

Minecraft servers are mostly limited by a single thread doing the world tick. If that thread cannot finish 20 times a second, the server is behind, and no amount of heap changes it.

Worse, an enormous heap makes pauses longer, because the collector has more to walk. A server given twenty gigabytes when it needed six can stutter more than it did before.

The symptom that actually means low RAM is a slow, steady decline over hours with the console warning about garbage collection, or an out of memory crash in the log. Random one second freezes are almost never RAM.

Find the real bottleneck

Install a profiler and read it before changing anything. The spark plugin gives a report naming the plugin, the entity type or the chunk work eating the tick. It takes five minutes and it is the difference between fixing lag and buying a bigger plan.

Common findings, in order of how often they turn up: too high a view distance or simulation distance, one plugin doing disk or database work on the main thread, thousands of hoppers or item frames in a farm, and mob farms with no entity limits.

Tuning that helps more than RAM

  • Drop simulation-distance before view-distance. Players notice view distance; they rarely notice simulation distance.
  • Cap entities per chunk and set mob farm limits.
  • Pre generate the world instead of letting players generate chunks live. Chunk generation is the heaviest thing a server does.
  • Put the world on NVMe storage.
  • Use a modern garbage collector configuration for large heaps rather than defaults, and change one thing at a time so you know what helped.

The two settings at the top of that list live in server.properties, and our server.properties reference lists what each one costs you. If you are still setting the server up, start with the Java server guide.

Frequently asked questions

Should Xms and Xmx be the same?

Yes, on a server. A fixed heap avoids resizing pauses, which are a common cause of periodic stutter.

How much RAM does a modded server need?

Start at four gigabytes and expect six to eight for a large pack. Mods add entities, block entities and world generation work, all of which cost memory and tick time.

Will more RAM fix TPS?

Rarely. Low TPS is usually a single thread bottleneck. Profile with spark and fix what it names.

Why did my server crash after I increased RAM?

You probably allocated more than the machine has, or left the OS too little. The JVM starts, then gets killed under load. Keep total allocation well below physical memory.

Next steps

All guides · Free owner tools · List your server