Sign In
Sign In

Minecraft Server Optimization

Minecraft Server Optimization
Hostman Team
Technical writer
Minecraft
14.08.2024
Reading time: 8 min

Running your own Minecraft servers can be challenging as the methods for creation and optimization frequently change. The game continually evolves, increasing the demands on the server infrastructure. Given Minecraft's enormous fan base, it's worth exploring this guide to ensure both tech enthusiasts are satisfied and there's no reason for critics to pounce on the server organizer..

What started as a simple concept—a world made of basic blocks—has gradually evolved into an environment for communication and creating complex structures that mimic the real world. This complexity imposes certain limitations. The more detailed a player's creations are, the greater the strain on the server's CPU and RAM which can result in Minecraft lagging. This situation is further complicated by multiple users connecting to a single host. Let's examine typical problems using the Java Edition as an example.

Types of Servers

Let's look at some popular Minecraft server types:

Game Client

The simplest version of a Minecraft server is the one integrated within the game client. All you need to do is create a new world, click confirm, and the virtual universe becomes accessible over a local network. However, you can only play with users on the same network, limiting this option to a few accounts, making it rarely used.

Vanilla

One of the popular types of Minecraft servers is Vanilla, the original server module developed by Mojang Studios. It offers basic functionality for creating a server with a personal virtual world, accessible from anywhere with an internet connection. It's relatively easy to set up, and beginners can find detailed instructions on the Minecraft Wiki.

This option is suitable only for beginners. As you delve deeper, you'll discover you cannot add plugins to extend the official Minecraft server's functionality. This limitation leads to higher RAM usage due to the lack of server-side optimization features.

Bukkit

Another Minecraft server option is Bukkit, which was created by enthusiasts who built upon the Vanilla version. They expanded it by adding support for mods and plugins. Bukkit attracts users with its less demanding memory requirements and the ability to add new types of blocks to the game.

This allows for more cost-effective hosting compared to a Vanilla server. However, the main drawback is that the Bukkit repository has been abandoned since 2014 because Mojang Studios recruited its developers, and now they work on official services.

SpigotMC

A common drawback of the previous Minecraft server options is the lack of automation. The game has evolved from a simple block world into a complex and engaging experience, so the introduction of API support in SpigotMC was timely. SpigotMC was developed by refining the abandoned Bukkit project, enhancing performance and reliability.

The only drawback of SpigotMC is its official blocking in Git repositories. To download the source code, you must use a special utility called BuildTools, which compiles the code yourself, rendering DMCA restrictions meaningless.

PaperMC

Another active Minecraft server project is PaperMC. Like SpigotMC, its key feature is API support, providing extensive options for creating or modifying existing plugins. Technically, it is a fork of SpigotMC, but PaperMC is more like a "new take" on optimizing Minecraft. It is supported by a well-developed community, which helps quickly address any issues.

Plugins developed for SpigotMC work on PaperMC without modification in 99% of cases. This backward compatibility makes it easy to experiment with both platforms without worrying about plugin availability. However, official support is limited to developments within the project.

Problems and Solutions

When creating a new Minecraft server, it's crucial to understand the application's architecture. For example, a significant portion of the resources will use only one CPU core, regardless of the number of processors allocated. The other cores will remain idle. You should consider this when renting cloud resources; clock speed may be more important than the number of cores, which doesn't necessarily impact performance.

Another important factor is the amount of RAM. Consider:

  • The number of worlds opened simultaneously.

  • The size of each generated virtual space.

  • The total number of players who will have access.

Additionally, remember that Java applications always require a certain amount of reserved memory to run smoothly. For example, if you estimate that 8 GB of RAM is needed, allocating up to 12 GB is better. These figures are approximate but effectively illustrate the point. Cloud hosting rates typically allow for resource reservation with a decent margin.

To avoid problems when launching a Minecraft server, follow these rules:

  • Monitor memory usage with tools like LagMeter for real-time insights into Minecraft lagging.

  • Regularly check for and install plugin updates. Developers are continually working on performance improvements and bug fixes.

  • Limit generated maps, for instance, using the WorldBorder plugin, to reduce server load.

  • Experiment with new plugins, replacing heavy modules with lighter ones with lower CPU and memory requirements.

  • Utilize drop cleanup plugins like NoLagg and McClean. These plugins help manage system resources by clearing up unused or "saved for later" drops, which accumulate and strain resources making Minecraft laggy. Check performance metrics before and after using these plugins to find the optimal server configuration.

Block Map Generation

Now, let's discuss gameplay. When players connect to the server for the first time, their character automatically appears at a common spawn point. This is the only location whose coordinates are pre-generated by the server based on configuration file settings. The key parameter here is the rendering distance, measured in chunks.

A chunk is a 16x16 area with a height of 256 blocks. The number of chunks allocated depends on the server settings and the owner's preferences. Generating the spawn point requires significant resources since it happens dynamically, storing data in RAM and continuously increasing the map file size.

The more users log into the server, the more crucial it becomes to understand how to optimize Minecraft and make it run faster. Beginners often base their server's capacity on the load from a single player, perhaps a couple of dozen at most. However, with a thousand players logging in, the server will likely crash under the strain. At best, they'll experience significant Minecraft lag during mass respawns, which frustrates players.

Minecraft default tick speed, or tick rate, is 20 TPS (Ticks Per Second). The server will timeout and eject players if it drops below 20. Ideally, one TPS equals 50 ms, with 1 second in the real world equaling 20 game ticks. Much depends on the server owner. For instance, the well-known 2b2t server comfortably handles a world border of 30 million blocks, with the map now at 8 TB and still growing.

However, not everyone can access such vast resources to support nearly infinite worlds. The solution is to limit your world to specific coordinates and pre-generate the map. This approach avoids server overload from dynamic block generation, allowing the CPU to focus on rendering the existing landscape. It also helps forecast memory usage.

The optimal approach is to use the WorldBorder plugin. Beginners should create a circular world centered on the spawn point using the command:

/wb set <radius in blocks> spawn

Players attempting to cross the boundary will be pushed back a few blocks. If a persistent player tries to cross the map's edge, they'll be automatically teleported back to the spawn point.

To pre-generate the world according to the selected shape, use the command:

/wb fill

And confirm with:

/wb confirm

An Intel Xeon Gold 6240 processor can generate a world with a 5,000-block radius in about two hours, creating approximately 40 billion blocks. As the radius increases, so does the time required for generation. TPS will drop significantly during map creation, so it's essential to account for this if active players are online. Also, allocate enough disk space in advance.

A 5,000-block radius map requires nearly 2 GB of disk space. These factors directly impact the choice of hosting plan when renting cloud resources. The plugin version is not critical; it was developed for Minecraft 1.14, and no compatibility issues have been reported, allowing for unrestricted experimentation. The full list of WorldBorder commands is available on the plugin's official forum.

Problematic Blocks

Dynamic block generation within the active map is another consideration when optimizing a Minecraft server. While dropped items add little load, massive explosions from TNT blocks can be resource-intensive. The issue lies in the physics engine, where gravity affects neighboring blocks blown up by TNT. The explosion triggers the generation of items from destroyed blocks, a highly resource-intensive process.

If your server's current configuration struggles with this load, disabling TNT blocks or end crystals may be wise to reduce lag in Minecraft. These can overload a weak server. You can easily avoid this by using the WorldGuard plugin, which works with WorldEdit and should be installed afterward.

Conclusion

This brief overview of Minecraft server optimization covers some of the "pain points" of resource management. Optimization isn't particularly complex, but planning for the maximum number of players per host is essential. Pre-generating maps can fit well into a promotion strategy. However, disabling popular blocks like TNT should be avoided, as their absence could impact the server's appeal, especially for new MC servers and newer communities.

Minecraft
14.08.2024
Reading time: 8 min

Do you have questions,
comments, or concerns?

Our professionals are available to assist you at any moment,
whether you need help or are just unsure of where to start
Email us