Sponge is Single-Threaded?


#1

Sponge is Single-Threaded?


#2

Yes, the current versions of sponge are. The bulk of the original minecraft code for java is single threaded so the bulk of sponge is single threaded.

That being said there are some parts of sponge that are asynced. This is normal to see in a Minecraft implementation such as CraftBukkit, Spigot, etc.

There is also the sponge event system that has a extra part of it that cannot run on async threads (I think its the cause system)

I believe the lantern project (a complete rewrite of the minecraft server from the group up) is mostly async, but dont quote me on that.


#3

Sponge is NOT single threaded. Neither is Minecraft.

However, the main game loop of Minecraft, like many many games IS single threaded.

Our cause tracking relies on a lot of state tracking that is added that mods have no idea exists.

This causes us to have a hard dependency on mods calling things in the correct threads, where as Vanilla Minecraft often only has very few or subtle bugs in this situation, so mods have been previously getting away with it, where as the base game never calls these methods from another thread, or synchronizes (for performance, as it was never designed to be multi-threaded)

We also add debugging and hard checks that COMPLAIN VERY LOUDLY when things are called from the wrong threads, this is because of the major yet subtle issues that it can cause, that wouldn’t be obvious otherwise. Calling out this behaviour in the logs saves us debugging time, and saves mod developers time from working out what is going wrong. This often gets mis-attributed as “Oh Sponge changes crap and makes it single threaded only” because (commonly) mod authors hadn’t encountered the subtle issues, or (rarely) had very carefully avoided them. (Which we can’t account for, it’s a core issue with core-modding that 2 core-mods will likely step on each others toes and can only be solved with careful negotiation)

So when you hear people say “Minecraft is single threaded” or “Sponge is single threaded” it’s a vast simplification of.

  1. Never call things from the wrong threads without very careful thought or scheduling.
  2. Do not optimize your Minecraft server hardware around multi-core performance, and optimize it around single core performance.
  3. Run multiple Minecraft servers on the same physical hardware, as the amount of cores (non virtual) machines have these days is borderline ridiculous.

Minecraft and Sponge are NOT ‘single threaded’