Is Cuberite Multi-threaded? A short explanation.
#1
Yes. But then again, so is the regular Java server. Let me elaborate on all of this.

Threads vs Cores
You will see "thread" and "core" used interchangeably, but what is the difference?
A thread is a single pipeline of instructions being executed. A core is a physical CPU core. Before multi-threaded processors, thread performance was core bound. While this is no longer strictly true, is still holds enough weight to not worry about this (IMO anyways).

Java Multi-threading
Java is multi-threaded, but it is so poorly implemented, you would be hard pressed to spot the difference if it wasn't. All worlds (dimensions are worlds) run on a single tick thread. All mobs and entities are also handled by this same thread. In fact, most anything involving the world and entities/players are on the tick. This is why you see/hear that singlethread performance is VERY important. The multi-threading comes into play for networking and garbage collection. These are insignificant for the CPU to handle however, so would appear as any of the other random activity you see on a CPU usage chart.

CubeRite Multi-threading
Cuberite starts out the box by not being written in Java, but rather C++ which is inherently faster. In fact, even if the code worked the same way as Java, it'd still be approximately 3x better in theory and handle accordingly. But it does do things a bit differently. Each world runs in a separate thread, network is handled in separate threads, world generation, saving and loading each gets a separate thread. This allows for a lot of optimization that grants more than just a 3x performance increase. Infact, a first gen Raspberry Pi can handle 8 players without much fuss. The software has been real-world tested with over 100 players without any performance loss software-side. I have personally had 450 console clients on a server with TPS dropping to just a stable 17.6 TPS.
Reply
Thanks given by: tigerw , NiLSPACE


Messages In This Thread
Is Cuberite Multi-threaded? A short explanation. - by Greaper88 - 05-14-2020, 08:22 PM



Users browsing this thread: 1 Guest(s)