If you’ve recently added more players, more mods, or both to your Minecraft server, then it might be time to allocate more RAM. Here’s how to do so for a smoother gameplay experience.
What Are The Benefits of Increasing Server RAM?
Allocating more RAM isn’t necessarily a silver bullet—oftentimes optimizing the server itself is a better solution than throwing more RAM at the problem—but there are certain situations where it is called for.
Minecraft is a very resource-intensive game, and increasing the amount of RAM allocated to your server can solve a variety of issues from phantom blocks to players rubber-banding and stuttering as they move across the map.
As you increase the numbers of players, add plugins and mods, build increasingly more sophisticated projects (like automated item sorters, farms, and such), and so on, the demand you put on the server increases. If you’ve gone from camping out in a dirt hut with one friend to building an elaborate Redstone creation with ten, it’s probably time to allocate more RAM.
Where Can You Use This Method?
There are different ways to host a Minecraft server. To save you time, let’s first talk about where you can and can’t use the method we’re about to outline.
Minecraft Realms: RAM Allocation Is Automatic
If you are using Minecraft Realms, the official Mojang server host, you can’t adjust your RAM allocation—and you don’t need to.
Minecraft Realms were originally hosted on Amazon Web Services (AWS) servers and are now, after a migration following the Microsoft acquisition of Mojang, hosted on Microsoft Azure servers. The whole time Realms has used a dynamic memory allocation system. Your Realms server simply increases or decreases how much RAM it uses without any intervention from the Realms owner.
Minecraft Hosts: You Have to Pay for More RAM
If you’re using a commercial Minecraft host you’re usually paying for a specific tier of hardware. In light of that, you can’t just increase your RAM allocation—you have to pay for a higher tier.
Sometimes you can simply pop over to the website and upgrade on the fly, other times you have to submit a support ticket and wait. Check your Minecraft host’s documentation for further information. Though before you rush to pay for more RAM we’d encourage you to read about how much RAM you really need and how you can avoid paying for upgrades by using a better-optimized version of the Minecraft server.
Self-Hosted: You Can Adjust The RAM Yourself
If you’re self-hosting your Minecraft server on hardware in your home or remotely on leased hardware, you can increase the RAM allocation up to the limitations imposed by the hardware itself and the overhead demands of the host system. Let’s look at how you do so now.
How to Allocate More RAM for Your Minecraft Server
There are quite a few variables in your server’s server.properties file that set the game mode, the view distance, and more. However, you won’t find any entries for RAM allocation.
Instead, RAM allocation is handled by command-line arguments passed along to the server software during startup. You set the size of the heap, or memory allocation, with the flags
--Xms which specify the maximum and initial heap size, respectively. You can use either megabyte or gigabyte designations like 1024M or 1G with the flags.
Let’s look at an example startup command and break down all the pieces.
java -Xmx1024M -Xms1024M -jar server.jar nogui
In the above command, we call on Java, we specify a starting heap size of 1024M and a maximum heap size of 1024M. The
-jar server.jar portion simply points Java’s jar archive tool at the server file, and the
nogui flag stops the server from creating a GUI window. You can take the GUI flag off if you want a GUI window with performance stats, a player list, and a live view of the server log.
If we want to increase the RAM allocation to, say, 2GB, you can simply shut down the server and run it again with increased values:
java -Xmx2048M -Xms2048M -jar server.jar nogui
You may have noticed that we’re not specifying a range, like 512M to 2048M in our commands, but using the same value for the minimum and maximum heap size. Setting the minimum and maximum as the same value sets the heap size to a fixed value which helps avoid performance hits as Java dynamically adjusts the heap size.
You might be curious what happens if you don’t set the memory allocation flags at all. Java will default to setting a Minimum HeapSize (the least amount of memory it will use) to 1/64 the physical RAM reported by the operating system and the Maximum HeapSize (the most memory it will use) to 1/4 the available RAM.
On most systems, this will be far too wide a range (and far too high a maximum value) and it will impact performance. In our discussion of how much RAM is good for a Minecraft server, we touch on the concept of the Java “garbage collector,” the built-in mechanism Java uses to manage RAM. In short, if you allocate too little RAM the collector runs too often and if you allocate too much RAM, the collector idles for too long and then runs too hard all at once.
Both are bad for performance so you should aim to increase the RAM allocation for your Minecraft server in modest increments, say from 1GB to 1.5GB to 2GB, until you achieve the results you want.
If you’re running the vanilla Minecraft server software and increasing the RAM doesn’t provide increased performance, consider switching to a heavily optimized fork of the vanilla server, like PaperMC. In our experience, switching to PaperMC yields performance gains higher than any amount of extra RAM allocation could provide.
Either way, with a few adjustments—be it to the RAM allocation or the server platform you’re using—you should be able to squeeze out the performance you’re looking for.
RELATED: How to Troubleshoot Minecraft LAN Game Problems
- › 6 Ways Our Tech Is Better Than Star Trek’s
- › Update iTunes on Windows Now to Fix a Security Flaw
- › What You Should (and Shouldn’t) Unplug or Turn Off When You Go On Vacation
- › 10 Kodi Features You Should Be Using
- › 5 Ways to See If Your Phone Is Being Tapped
- › How to Add a Shortcut to Pretty Much Anything on Android