Mineshire
All posts

Performance

How much RAM does a Minecraft server need?

· 3 min read

Ask five people how much RAM a Minecraft server needs and you’ll get five numbers, all delivered with total confidence. The honest answer is “it depends”, which isn’t useful on its own, so here’s what it depends on and how to land on a sensible figure.

What the memory is actually used for

The server keeps the parts of the world near players loaded in memory. It also holds every entity in those areas, every loaded plugin or mod, and a pile of temporary objects that the game creates and throws away constantly.

So memory use grows with three things: how many players are online, how far apart they’ve spread, and how much you’ve installed. Ten players standing in one base cost far less than ten players exploring in ten directions.

Starting numbers that work

Treat these as a first guess, not gospel. Your own server will tell you soon enough if one is wrong.

  • A vanilla or Paper server for you and a few friends: 2 to 3 GB is plenty.
  • Ten to twenty players on plugins, with some world protection: aim for 4 to 6 GB.
  • A big modpack: 6 to 10 GB, sometimes more, since mods add blocks, items and entities that all need room.
  • A bigger community with lots of plugins wants 8 GB and up, and by then you really want a machine that isn’t also your gaming PC.

Modded servers are the surprise for most people. A pack with a few hundred mods can ask for several gigabytes before anyone has even joined, just to load everything.

More is not always better

It’s tempting to hand the server 16 GB and forget about it. That can backfire. Java cleans up unused memory in bursts called garbage collection, and the more memory there is to sweep, the longer a burst can take on some setups. You feel it as a short freeze every so often.

Home PCs have a second problem. Windows, your browser and your own Minecraft client want memory as well. Give the server most of it and Windows starts swapping to disk, which slows everything down, the server too.

Mineshire guards against this. It warns you when the amount you’ve chosen goes above half of your computer’s memory, and it won’t go past 75%.

How to set it

Java takes two flags. -Xmx sets the most memory the server may use, and -Xms sets how much it grabs when it starts. Many people set both to the same number so the server doesn’t spend its first minutes growing.

java -Xms4G -Xmx4G -jar server.jar nogui

In Mineshire you skip the flags and move a slider in the server’s settings. Same result, less typing, and no chance of typing G where you meant M.

How to tell if you got it wrong

Too little memory shows up as repeated lag spikes, “Can’t keep up!” messages in the console, or a crash with an OutOfMemoryError. Too much shows up as occasional long freezes while nothing else seems wrong.

The most reliable way to know is to watch. Look at the memory graph while players are online. If the used line climbs close to your limit and stays there, raise it. If it sits at a third of the limit all day, you can lower it, and the rest goes back to your PC.

And if the numbers look fine but the server still feels slow, memory probably isn’t the problem. View distance, plugins and the processor are the usual suspects, which is a whole other post.

Quick answers

That sawtooth shape in the memory graph is normal. Java lets unused objects pile up and clears them in one go, so the line climbs and drops again and again.

Four gigabytes is plenty for a few friends on Vanilla or Paper. A big modpack usually wants more.