5 Simple Tricks to Speed Up and Optimize Minecraft in Linux

A picture showing a person playing a PC game.

From creating massive structures to exploring a near-infinite world, Minecraft is a game with endless potential. While Minecraft will run on almost any platform and device, some users might find it difficult to run smoothly on UNIX-like systems. In this article, I will go through 5 easy tricks that you can do to optimize your Minecraft experience on Linux.

1. Use a Lightweight Minecraft Launcher

One of the easiest tricks to optimize your Minecraft install in Linux is to use an alternative launcher. These are third-party apps that improve and expand on the default launcher experience. They often ship with additional features such as the ability to run multiple Minecraft instances, manage mods, and maintain world backups.

A screenshot showing the Prism Launcher default screen in Ubuntu Linux.

Apart from that, alternative launchers come with tools which can provide a deeper look at Minecraft’s internals. For instance, Prism Launcher comes with a “Logs” tool that shows both current and past game logs for your instance. This makes it really easy to diagnose existing and potential issues with your Minecraft install.

A screenshot showing the logs generated by Prism Launcher for a Minecraft instance.

Further, alternative launchers also expose some of the hidden options for your instance. These include the ability to set a custom screen resolution, environment variables, and support for legacy versions. As someone who plays in multiple game versions, I find this essential to keeping track my Minecraft instances.

2. Match the Minimum and Maximum Memory Parameters

If you’ve ever run a Minecraft server, you’re probably familiar with the memory allocation variables for Java. In gist, these are the parameters that determine how much RAM the Java Virtual Machine (JVM) will prepare for your server and client programs.

A terminal showing a basic server startup script for Minecraft.

Right out of the box, Minecraft sets the minimum memory variable (-Xms) to around 512 MB while it allocates 2 GB for its maximum (-Xmx). One problem with this is that it increases the amount of garbage collection that Minecraft does as its builds up its memory usage. This results in FPS stuttering especially in low end systems.

To fix this, all you need to do is to make sure that both the minimum and maximum variable are set to the same value. This trick disables the heap resizing feature in Java and minimizes the garbage collection that Minecraft needs to do while running the game.

To change the default memory allocation, go to the Installations tab in your Minecraft Launcher, click the icon beside your Minecraft instance.

A screenshot showing the instance editing menu for the default Minecraft Launcher.

Select Edit, then click More Options.

Remove the contents of the JVM Arguments text box, then paste the following line of code inside it:

-Xms4G -Xmx4G

Click the Save button, then start Minecraft to apply your new settings.

Good to know: are you a prolific Minecraft server admin? Optimize and streamline your hosting backend today with Crafty.

3. Enable the Generational Z Garbage Collector

Garbage collection is an integral part of any Java application. In Minecraft, it acts as a way for the game to free up unused chunk and player data. When done correctly, this results in a much more consistent experience in the long run.

Minecraft uses Parallel GC as its default garbage collector. While it works for general programs, it’s not designed to run well on real-time apps such as games. As a consequence, Minecraft often pauses and stutters when doing memory intensive tasks such as generating chunks.

To fix this issue, go to the Installations tab, then click the icon beside your Minecraft’s instance.

Click Edit on the popup menu, then More Options.

Add the following line of code to the JVM Arguments textbox:

-XX:+UseZGC -XX:+ZGenerational
A screenshot highlighting the modified JVM arguments that use Generational ZGC.

Doing this will enable the Generational Z Garbage Collector (ZGC) which is a more finely tuned GC for real-time apps. Based on what I’ve seen, Generational ZGC removes 80-90% of the lag spikes that occur when loading chunks. It also maintains a consistent FPS throughout a play session.

Note: Generational ZGC is only available for Java 21 and beyond. This means that the flags above will not work if you’re using Java 8 and 17.

4. Install Performance Enhancing Mods

Mods are core to the identity of Minecraft. Not only do they offer additional content but they also add new features and tweaks to the game. These range from texture packs that change how blocks look to modpacks that transform how Minecraft works.

Beyond that, mods can also provide much needed optimizations on Minecraft itself. For example, Optifine and Sodium improve how the Minecraft renderer works, allowing for massive FPS gains and a more detailed graphics settings page. Personally, I use Sodium along with ScalableLux which adds around 25-30 FPS on my Minecraft instance.

A screenshot showing two popular performance mods for Minecraft.

Apart from improvements on the Minecraft renderer, there’s also mods that tweak how chunk generation and mechanics work. These not only provide additional FPS gains but make your game less prone to instability and crashes.

A screenshot showing the webpage for the Concurrent Chunk Management Engine, a chunk performance mod for Minecraft.

On a side note: check out some of the best games available in Linux today.

5. Use the GraalVM JVM Runtime

At the end of the day, Minecraft is a Java application that runs on the JVM. This means that the game could still perform badly if you’re using a suboptimal JVM runtime.

By default, Minecraft uses the JVM runtime you have on your Linux distro. This is usually OpenJDK if you’ve installed it from your distro’s package repository. While it’s a decent option, it usually doesn’t have the optimizations that benefit real-time apps such as Minecraft.

A screenshot showing the OpenJDK webpage.

One way to fix this is by installing the GraalVM runtime. This is Oracle’s performance-focused solution that uses JIT and AOT to provide an efficient and fast binary capable of running real-time Java programs. In my experience, this makes Minecraft a lot more consistent in terms of responsiveness and FPS.

An in-game screenshot highlighting the use of GraalVM on Minecraft 1.21.4.

Having said that, the biggest downside of using GraalVM is that Generational ZGC currently doesn’t work with the runtime. As such, you need to use either the Parallel GC or G1GC as your garbage collector for GraalVM.

To change your JVM runtime, first download the GraalVM binary from its project website.

Extract the tar file on your Home directory, then open a new terminal session.

Copy the GraalVM folder to your distro’s JVM directory:

sudo cp -rv ./graalvm-jdk-* /usr/lib/jvm/

Go to the Installations tab on the Minecraft Launcher, click on your instance, then select More Options.

Click Browse on the Java Executable textbox, then navigate to the location of your GraalVM binary in “/usr/lib/jvm/.”

Go inside the GraalVM folder, select the “bin” folder, then “java.”

A screenshot showing the browse window showing the location of the GraalVM JVM binary.

With these simple tricks up your sleeve, the only thing left to do is to use them to optimize your personal Minecraft world in Linux. To that end, we’ve compiled some of the best Minecraft seeds that you can use to generate your own custom world.

Image credit: Fausto Sandoval via Unsplash. All alterations and screenshots by Ramces Red.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Ramces Red Avatar