Jump to content

Minecraft Finally Gets Multi-Threaded Servers

GhostRoadieBL

Summary

 It took many years but PaperMC have cracked multi-threaded servers for Minecraft. Due to 99% of mods being single threaded, the server mod is still vanilla MC but the codebase is available on GitHub so expect some of the more popular mods to transition to multi-threaded server support. 

folia_feat.webp.84c8785fa0435dcf1f04dc5120c5bdad.webp

Quotes

Quote

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.

minecraft-server-utilization.webp.d06918c824affa91c775c83983703092.webp

My thoughts

 This is huge! I know there are only a few servers which would actually hit the required player counts to need multi-threading but to be able to host potentially thousands of players in a single world could, theoretically, introduce competition to Fortnite, Roblox and other large player world games and expand minecraft's use cases. There are already themepark and museum servers which will undoubtedly benefit from reducing their server costs with wasted threads idle.

 

Sources

https://hackaday.com/2023/04/03/minecraft-finally-gets-multi-threaded-servers/

The best gaming PC is the PC you like to game on, how you like to game on it

Link to comment
Share on other sites

Link to post
Share on other sites

I might be crazy, but aren't Minecraft servers already multithreaded to some degree? I've definitely seen cases where my Minecraft servers have used >50% CPU usage on a Ryzen 7 4800h. It looks like this modification is specifically for chunk ticks, which is certainly interesting though.

Computer engineering grad student, cybersecurity researcher, and hobbyist embedded systems developer

 

Daily Driver:

CPU: Ryzen 7 4800H | GPU: RTX 2060 | RAM: 16GB DDR4 3200MHz C16

 

Gaming PC:

CPU: Ryzen 5 5600X | GPU: EVGA RTX 2080Ti | RAM: 32GB DDR4 3200MHz C16

Link to comment
Share on other sites

Link to post
Share on other sites

I think the main thing for this is similar how older mmo's did engine reworks to put more players together. Increase the look and feel of it being a very active community even if only a couple hundred people are online.

 

This has been a proven strategy to keep interest in the game and pull new people in as well you see fellow players so that means there is active stuff going on and thus you might want to pull in some friends because the game doesn't look dead.

 

Also super happy it happened because there is another HUGE thing here. People using older slow systems at home for a mc server with some friends can now continue using their old pc instead of having to upgrade.

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, dcgreen2k said:

I might be crazy, but aren't Minecraft servers already multithreaded to some degree? I've definitely seen cases where my Minecraft servers have used >50% CPU usage on a Ryzen 7 4800h. It looks like this modification is specifically for chunk ticks, which is certainly interesting though.

Sorta. It's a single thread that can direct other threads to do certain tasks. But this thing seems to take away a lot of the load of that single thread and spread it out.

 

So basically the scheduler for everything now has less to do which means it can do more of what it still needs to do. I'll have to try this out on the old nas we used to use as a mc server with a athlon 5150 that stopped being good enough a while ago.

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, jaslion said:

snip

I see. I've been programming for a couple years, including with Java, but I don't have much experience with multithreading. Definitely an interesting addition though.

Computer engineering grad student, cybersecurity researcher, and hobbyist embedded systems developer

 

Daily Driver:

CPU: Ryzen 7 4800H | GPU: RTX 2060 | RAM: 16GB DDR4 3200MHz C16

 

Gaming PC:

CPU: Ryzen 5 5600X | GPU: EVGA RTX 2080Ti | RAM: 32GB DDR4 3200MHz C16

Link to comment
Share on other sites

Link to post
Share on other sites

5 minutes ago, dcgreen2k said:

I see. I've been programming for a couple years, including with Java, but I don't have much experience with multithreading. Definitely an interesting addition though.

Honestly multi threading is skipable in 95% of the use cases BUT is super handy when you can have a task that can be spread out over many cores that will take a while :p.

 

That or your project lead promises up to 8 core multi threading for your project that is something quite basic and is all serial in nature and needs to work step by step to function so you have to bs the hell out of things and show activity on 8 cores :D.

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, jaslion said:

Also super happy it happened because there is another HUGE thing here. People using older slow systems at home for a mc server with some friends can now continue using their old pc instead of having to upgrade.

I also thought of this as I read the post, glad I'm not the only one!

: JRE #1914 Siddarth Kara

How bad is e-waste?  Listen to that Joe Rogan episode.

 

"Now you get what you want, but do you want more?
- Bob Marley, Rastaman Vibration album 1976

 

Windows 11 will just force business to "recycle" "obscolete" hardware.  Microsoft definitely isn't bothered by this at all, and seems to want hardware produced just a few years ago to be considered obsolete.  They have also not shown any interest nor has any other company in a similar financial position, to help increase tech recycling whatsoever.  Windows 12 might be cloud-based and be a monthly or yearly fee.

 

Software suggestions


Just get f.lux [Link removed due to forum rules] so your screen isn't bright white at night, a golden orange in place of stark 6500K bluish white.

released in 2008 and still being improved.

 

Dark Reader addon for webpages.  Pick any color you want for both background and text (background and foreground page elements).  Enable the preview mode on desktop for Firefox and Chrome addon, by clicking the dark reader addon settings, Choose dev tools amd click preview mode.

 

NoScript or EFF's privacy badger addons can block many scripts and websites that would load and track you, possibly halving page load time!

 

F-droid is a place to install open-source software for android, Antennapod, RethinkDNS, Fennec which is Firefox with about:config, lots of performance and other changes available, mozilla KB has a huge database of what most of the settings do.  Most software in the repository only requires Android 5 and 6!

 

I recommend firewall apps (blocks apps) and dns filters (redirect all dns requests on android, to your choice of dns, even if overridden).  RethinkDNS is my pick and I set it to use pi-hole, installed inside Ubuntu/Debian, which is inside Virtualbox, until I go to a website, nothing at all connects to any other server.  I also use NextDNS.io to do the same when away from home wi-fi or even cellular!  I can even tether from cellular to any device sharing via wi-fi, and block anything with dns set to NextDNS, regardless if the device allows changing dns.  This style of network filtration is being overridden by software updates on some devices, forcing a backup dns provuder, such as google dns, when built in dns requests are not connecting.  Without a complete firewall setup, dns redirection itself is no longer always effective.

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, jaslion said:

I'll have to try this out on the old nas we used to use as a mc server with a athlon 5150 that stopped being good enough a while ago.

Wow!  I've been wanting AM1 system for quite some time.  There were still a few ebay sellers with them, but I couldn't quite budget it out.  I wonder if those have found a home yet, and if there are others wanting to sell them, I sure hope so.

 

25 watt TPD and decent GPU support.  It is a limited platform, but it would make a great low power x86 server!  I just have the xeon system, it idles around maybe 40-45 watts or so (I haven't measured it with my current low power setup, so that's a total guess).  I know it's around 52 at 3.2 Ghz base wifh EIST enhanced intel speed step enabled.  So assuming it must be lower than that now.

: JRE #1914 Siddarth Kara

How bad is e-waste?  Listen to that Joe Rogan episode.

 

"Now you get what you want, but do you want more?
- Bob Marley, Rastaman Vibration album 1976

 

Windows 11 will just force business to "recycle" "obscolete" hardware.  Microsoft definitely isn't bothered by this at all, and seems to want hardware produced just a few years ago to be considered obsolete.  They have also not shown any interest nor has any other company in a similar financial position, to help increase tech recycling whatsoever.  Windows 12 might be cloud-based and be a monthly or yearly fee.

 

Software suggestions


Just get f.lux [Link removed due to forum rules] so your screen isn't bright white at night, a golden orange in place of stark 6500K bluish white.

released in 2008 and still being improved.

 

Dark Reader addon for webpages.  Pick any color you want for both background and text (background and foreground page elements).  Enable the preview mode on desktop for Firefox and Chrome addon, by clicking the dark reader addon settings, Choose dev tools amd click preview mode.

 

NoScript or EFF's privacy badger addons can block many scripts and websites that would load and track you, possibly halving page load time!

 

F-droid is a place to install open-source software for android, Antennapod, RethinkDNS, Fennec which is Firefox with about:config, lots of performance and other changes available, mozilla KB has a huge database of what most of the settings do.  Most software in the repository only requires Android 5 and 6!

 

I recommend firewall apps (blocks apps) and dns filters (redirect all dns requests on android, to your choice of dns, even if overridden).  RethinkDNS is my pick and I set it to use pi-hole, installed inside Ubuntu/Debian, which is inside Virtualbox, until I go to a website, nothing at all connects to any other server.  I also use NextDNS.io to do the same when away from home wi-fi or even cellular!  I can even tether from cellular to any device sharing via wi-fi, and block anything with dns set to NextDNS, regardless if the device allows changing dns.  This style of network filtration is being overridden by software updates on some devices, forcing a backup dns provuder, such as google dns, when built in dns requests are not connecting.  Without a complete firewall setup, dns redirection itself is no longer always effective.

Link to comment
Share on other sites

Link to post
Share on other sites

2 hours ago, GhostRoadieBL said:

Summary

 It took many years but PaperMC have cracked multi-threaded servers for Minecraft. Due to 99% of mods being single threaded, the server mod is still vanilla MC but the codebase is available on GitHub so expect some of the more popular mods to transition to multi-threaded server support. s/

 

Java has had multi-threading since it's ineception, in like 1997 or something. I distinctly remember this. Why don't more programs use multi-threading? Because multithreading and multi-core systems were not really a thing until about 10 years later. That is well before Minecraft.

 

But game developers often don't care about threading because it's difficult to break a game into threads. In induces a lot of latency. The go-to has been "coroutines" which is basically not threads, and doesn't scale to multi-cores.

 

Even Unity, still doesn't multi-thread things. If you want threads, rewrite your game to use Unreal Engine. AI is particularly good at being threaded, but you can't create 1000 threads for a world of 1000 "AI" objects. you're probably going to create one thread per type (Eg spiders, ducks, cats, villagers, etc) and have that thread apply the same piece of logic to each instanced object.

 

So a "multithreaded" mod for a game that operates on a native multithreaded environment seems like a no-brainer really. But I can't imagine it being viable unless mods are re-written to be aware of it, because a big thing in multi-threading in other languages (eg perl, php, python, javascript) is that nobody uses the threading in it, because it ultimately doesn't work. It makes things too complicated. If the task you need isn't perfectly parallelizable, you don't thread it. You use the threads to do different tasks to avoid stepping on each other, and that's it. A game ultimately will likely never use more than 2-3 threads because too much is timing sensitive (eg input and netcode) to have to wait for locks.

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

6 hours ago, E-waste said:

Wow!  I've been wanting AM1 system for quite some time.

Dont its shit and a waste of money

 

Mine idles at around 35w because the cpu is constantly near 60% just trying to exist it is super slow.

 

Fyi tdp does NOT equal wattage consumed. It often goes to 55w or more.

Link to comment
Share on other sites

Link to post
Share on other sites

Nice. Hopefully modding follows suit. I know we ran into tick issues on my modded server when multiple bases started to get developed 

Someone told Luke and Linus at CES 2017 to "Unban the legend known as Jerakl" and that's about all I've got going for me. (It didn't work)

 

Link to comment
Share on other sites

Link to post
Share on other sites

10 hours ago, Kisai said:

Java has had multi-threading since it's ineception, in like 1997 or something. I distinctly remember this. Why don't more programs use multi-threading? Because multithreading and multi-core systems were not really a thing until about 10 years later. That is well before Minecraft.

I don't know if there was anything earlier, but more than one core/thread started to be popularised in enthusiast area by the Abit BP6 motherboard released in 1999. You could slap two Celerons in that for what was then a kicking machine. I had a pair of Celeron 366 bus overclocked to 550 MHz, also forcing me to move from Win9x to Win2k to support it. I don't recall any consumer software using more than one thread at the time, but it helped with multi-tasking regardless. Mainstream multi-thread may have been Intel's introduction of Hyper-Threading in 2002. AMD bought dual core to the masses in 2003.

 

10 hours ago, Kisai said:

If the task you need isn't perfectly parallelizable, you don't thread it. You use the threads to do different tasks to avoid stepping on each other, and that's it. A game ultimately will likely never use more than 2-3 threads because too much is timing sensitive (eg input and netcode) to have to wait for locks.

This is likely a main problem. A lot of things just can't be scaled well across parallel threads. Something will be critical path, and that will still limit ultimate performance. I wouldn't be so hard to say something needs to be perfectly parallelisable to be worth it. Prime95 shows a performance (efficiency) loss as you assign ever more threads to a worker, but this often still works out better than running more workers with fewer threads due to limitations elsewhere.

 

Not sure what games do, but they do scale to more threads than ever. On my own system I've seen performance scaling of Watchdogs Legion where running the full 12 cores of my system performs clearly better than limiting it to 8. I was hoping any clock increase from limiting to 8 would help more. TLOU for all its problems can max out the CPU especially at higher settings. Games must be doing something with all that CPU.

Gaming system: R7 7800X3D, Asus ROG Strix B650E-F Gaming Wifi, Thermalright Phantom Spirit 120 SE ARGB, Corsair Vengeance 2x 32GB 6000C30, RTX 4070, MSI MPG A850G, Fractal Design North, Samsung 990 Pro 2TB, Acer Predator XB241YU 24" 1440p 144Hz G-Sync + HP LP2475w 24" 1200p 60Hz wide gamut
Productivity system: i9-7980XE, Asus X299 TUF mark 2, Noctua D15, 64GB ram (mixed), RTX 3070, NZXT E850, GameMax Abyss, Samsung 980 Pro 2TB, random 1080p + 720p displays.
Gaming laptop: Lenovo Legion 5, 5800H, RTX 3070, Kingston DDR4 3200C22 2x16GB 2Rx8, Kingston Fury Renegade 1TB + Crucial P1 1TB SSD, 165 Hz IPS 1080p G-Sync Compatible

Link to comment
Share on other sites

Link to post
Share on other sites

3 hours ago, porina said:

 

 

Not sure what games do, but they do scale to more threads than ever. On my own system I've seen performance scaling of Watchdogs Legion where running the full 12 cores of my system performs clearly better than limiting it to 8. I was hoping any clock increase from limiting to 8 would help more. TLOU for all its problems can max out the CPU especially at higher settings. Games must be doing something with all that CPU.

DX12/Vulkan games use more threads because they were designed to, where as DX9 and OpenGL can't actually get over 1 thread for rendering. There's simply no way to do that. Java has generally used OpenGL, and that's why things like "RTX" doesn't actually work on it, because to get such features requires intercepting those OpenGL calls with something that actually uses Vulkan.

 

Like Portal RTX is really just Portal + DXVK+asset swaps.

 

Link to comment
Share on other sites

Link to post
Share on other sites

I hope the other modded server developers will be able to implement it, paper devs have a few decisions i dont quite like (like ripping out the chat report feature, or at least making it an option).....

Link to comment
Share on other sites

Link to post
Share on other sites

On 4/7/2023 at 9:32 AM, Kisai said:

But game developers often don't care about threading because it's difficult to break a game into threads. In induces a lot of latency. The go-to has been "coroutines" which is basically not threads, and doesn't scale to multi-cores.

Shocking how such a large company struggle to do multithread on a game that operates on 30 ticks after 10 years of development. 

 

Even more shocking is that Bedrock edition also suffers from this despite not built on Java.

Specs: Motherboard: Asus X470-PLUS TUF gaming (Yes I know it's poor but I wasn't informed) RAM: Corsair VENGEANCE® LPX DDR4 3200Mhz CL16-18-18-36 2x8GB

            CPU: Ryzen 9 5900X          Case: Antec P8     PSU: Corsair RM850x                        Cooler: Antec K240 with two Noctura Industrial PPC 3000 PWM

            Drives: Samsung 970 EVO plus 250GB, Micron 1100 2TB, Seagate ST4000DM000/1F2168 GPU: EVGA RTX 2080 ti Black edition

Link to comment
Share on other sites

Link to post
Share on other sites

13 minutes ago, williamcll said:

Shocking how such a large company struggle to do multithread on a game that operates on 30 ticks after 10 years of development. 

 

Even more shocking is that Bedrock edition also suffers from this despite not built on Java.

Because multithreading the game to this degree wasn't worth the development effort, especially when the scenario this modification is made for is an edge case. It's obviously possible, but there isn't much that can be fully parallelized in the game without requiring a complete rewrite or ending up breaking an existing part of the game. From a developer's perspective, if a task can't be perfectly parallelized, then the vast majority of the time it will be written to run on a single thread. There's a reason this modification specifically targets chunk ticks, since chunks can be grouped into regions that act independently of each other.

Computer engineering grad student, cybersecurity researcher, and hobbyist embedded systems developer

 

Daily Driver:

CPU: Ryzen 7 4800H | GPU: RTX 2060 | RAM: 16GB DDR4 3200MHz C16

 

Gaming PC:

CPU: Ryzen 5 5600X | GPU: EVGA RTX 2080Ti | RAM: 32GB DDR4 3200MHz C16

Link to comment
Share on other sites

Link to post
Share on other sites

this has been done douzens of times, and it always results in:

- other things breaking

- duping bugs

- random glitches when things interact between threads

 

the only thing that is single threaded in minecraft is the tick thread (world gen and networking should be at least partially threaded iirc.) and the solution here is just to move things *out* of the tick thread that dont belong there, instead of breaking up the very thing that makes duping in vanilla minecraft actually exceptionally rare...

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×