If you 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 it for a smoother gaming experience.
What are the benefits of increasing server RAM?
assign more RAM it’s not necessarily a silver bullet; a Often optimizing the server itself is a better solution than throwing more RAM at the problem, but there are certain situations where it is required.
Minecraft is a resource-intensive game, and increasing the amount of RAM allocated to your server can solve a variety of issues, from ghost blocks to players getting stuck and stuttering while moving around the map.
As the number of players increases, you add plugins and mods, create more and more sophisticated projects (such as automated item sorters, farms, etc.), and so on, the demand you put on the server increases. If you went from camping in a dirt shack with a 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 describe.
Minecraft Realms: RAM allocation is automatic
If you are using Minecraft Realms the official Mojang server host, cannot and does not need to adjust its RAM allocation.
Minecraft Realms was originally hosted on servers from Amazon Web Services (AWS) and now, after a migration following Microsoft’s acquisition of Mojang, they are hosted on Microsoft Azure servers . All along Realms has used a dynamic memory allocation system. Your Realms server simply increases or decreases the amount of 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 level of hardware. In light of that, you can’t just increase your RAM allocation, you have to pay for a higher level.
Sometimes you can just visit the website and update as you go, other times you have to submit a support ticket and wait. See your Minecraft host’s documentation for more information. However, before you rush to pay for more RAM, we recommend that you read up on 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 host your own Minecraft server on your home hardware or remotely on rented hardware, you can increase the RAM allocation up to the limitations imposed by the hardware itself and the overall demands of the host system. Let’s see how you do now.
How to Allocate More RAM for Your Minecraft Server
There are quite a few variables in server.properties file from your server that set the game mode, viewing distance, and more. However, you will not find any entry for RAM allocation.
Instead, RAM allocation is handled by command line arguments that are passed to the server software during startup. Set the heap size, or memory allocation, with the flags
--Xmswhich specify the maximum and initial size of the heap, respectively. You can use megabyte or gigabyte designations like 1024M or 1G with the flags.
Let’s look at an example startup command and walk through all the pieces.
java -Xmx1024M -Xms1024M -jar server.jar nogui
In the above command, we call Java, specify an initial heap size of 1024M and a maximum heap size of 1024M. The
-jar server.jarportion simply points the Java jar file tool to the server file, and the
noguiflag prevents the server from creating a GUI window. You can remove the GUI flag if you want a GUI window with performance stats, a list of players, and a live view of the server log.
If we want to increase the RAM allocation to, say, 2 GB, we 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 are not specifying a range, such as 512M to 2048M in our commands, but instead use the same value for the minimum and maximum heap size. Setting the min and max to the same value sets the heap size to a fixed value which helps avoid performance impacts as Java dynamically adjusts the heap size.
You might be curious what happens if you don’t set memory allocation flags at all. Java will default to a minimum heap size (the least amount of memory it will use) at 1/64 of the physical RAM reported by the operating system, and the maximum heap size (the most memory it will use) at 1/4 of the available RAM.
On most systems this will be too wide a range (and too high a maximum value) and will affect performance. In our discussion about how much ram is good for a minecraft server we touch the concept of » garbage collector » from Java , the built-in mechanism that 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 sits idle for too long and then runs too hard at the same time.
Both are bad for performance, so you should try increasing the RAM allocation for your Minecraft server in modest increments, say 1GB to 1.5GB to 2GB, until you achieve the results you want.
If you’re running vanilla Minecraft server software and increasing RAM doesn’t provide increased performance, consider switching to a highly optimized fork of the vanilla server, such as PaperMC . In our experience, switching to PaperMC produces performance gains greater than any additional RAM allocation could provide.
Either way, with a few tweaks to either your RAM allocation or the server platform you’re using, you should be able to get the performance you’re looking for.