Minecraft Finally Gets Multi-Threaded Servers

Minecraft Finally Gets Multi-Threaded Servers

Source Node: 2561075

Minecraft servers are famously single-threaded and those who host servers for large player bases often pay handsomely for a server that has gobs of memory and ripping fast single-core performance. Previous attempts to break Minecraft into separate threads haven’t ended successfully, but it seems like the folks over at [PaperMC] have finally cracked it with Folia.

Minecraft is one of (if not the most) hacked and modded games in history. Mods have been around since the early days, made possible by a dedicated group who painstakingly decompiled the Java bytecode and reverse-engineered it. Bukkit was a server mod back in the Alpha days that tried to support plugins and extend the default Minecraft. From Bukkit, Spitgot was forked. From Spitgot, Paper was forked, which focused on performance and gameplay mechanics. And now from Paper, Folia is a new fork focused on multi-threading.

A Minecraft world is split up into worlds (such as the nether or the overworld) and chunks. Chunks are 16x16xZ vertical columns of blocks. Folia breaks up sections of chunks into regions that can be ticked independently. Of course, moving to a multi-threaded model will cause existing plugins to fail. Very little was made thread-safe and the idea is that data cannot move easily across ticking regions. Regions tick in parallel, not synchronously.

Naturally, the people benefiting from Folia the most are those running servers that support hundreds of players. On a server with a vanilla-like configuration only around a hundred or so players can be online. Increasing single-core performance isn’t usually an option past this point. By moving to other cores, suddenly you can scale out significantly without restoring to complex proxying. Previous attempts have had multiple Minecraft servers and then synced players and entities between them. Of course, this can cause its own share of issues.

It’s simply incredible to us what the modding community continues to develop and create. It takes deep patience to reverse-engineer the system and rearchitect it from the outside. The Folia codebase is available on GitHub under a GNU GPL 3.0 license if you’d like to look through it.

Time Stamp:

More from Hack A Day