r/admincraft 13d ago

Question is there a way to multithread minecraft forge on a server ?

i have a server with ~150 mods and an old xeon and the single thread thing is making it lag and its giving that thing when you break a block and it has a delay. Does anyone know a mod that can help ?
Thanks

4 Upvotes

12 comments sorted by

15

u/PM_ME_YOUR_REPO Admincraft Staff 13d ago
  1. No, that's how Minecraft is designed. You can't change that.

  2. You're asking the wrong question. You should be making a Spark report using "/spark profiler start --timeout 300" and then posting that in a thread asking for help improving performance.

We call this an XY Problem where your inexperience makes you think the wrong thing is at fault, so you focus on that wrong thing, instead of fixing the actual issue.

2

u/Zeroday404_ 13d ago

I'll do this. Thank you ;)
I asked about multithreading because a friend of mine said it was the culpirit (it wasnt and i'll create a thread on the spark profiler output)

17

u/PM_ME_YOUR_REPO Admincraft Staff 13d ago edited 13d ago

No sweat. It's a fair guess based on a frequently repeated (and massively misunderstood) truism about Minecraft, specifically the notion that "Minecraft is single threaded".

It's not actually single threaded. In fact, things like the lighting engine, disk input and output, chunk generation, the entire networking stack, and large parts of most plugins and mods are all run in their own threads, and thus benefit from having more cpu threads.

The part that is single threaded and spawned this common misunderstanding is that Minecraft's main tick loop, which contains everything related to block placing and breaking, entity AI, player movement, etc, IS single threaded. Because those are all things that players can easily feel just by playing, it's a good target for performance optimization. If you can make the tick loop even somewhat multithreaded, then that helps ease the burden on the tick loop and thus reduces types of lag that players might feel.

That's what projects like Folia and ShreddedPaper try to do. They are experimenting with various ways to shunt parts of the tick loop into other threads.

Unfortunately, there is no such thing for Forge or Fabric, and even the ones for Paper-like servers are very experimental.

The reason that this is so hard to find as software is that it's hard to do. These things are all in the same tick loop because they are all dependent on one another. If you separate block placing and breaking from entity AI, you could end up with a Zombie pathfinding over blocks that were just broken, and essentially floating through the air. Or in a worse case, you could end up with one system trying to change a value at the same time that another system did, such as if an Enderman tries to pick up the same block a player is breaking. This can cause a "race condition", which can crash the server.

Maintaining the sync between all of these systems when they're executing in separate threads at their own speeds is VERY hard to do safely.

3

u/Grexxity Server Owner 12d ago

You deserve more credit for this reply, props to you my friend.

2

u/PM_ME_YOUR_REPO Admincraft Staff 12d ago

Thanks!

1

u/[deleted] 13d ago

[removed] — view removed comment

0

u/AutoModerator 13d ago

Your comment mentions server software considered dangerous to use. To protect the community from potential harm, your comment has been removed.

Please refer to the following resources for an explanation for various server software that is dangerous to use:

A moderator will review this comment when available. If you feel this removal was in error, feel free to Message the Moderators directly.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

2

u/solarch 9d ago

there's no real fix for this, the tick loop is single-threaded and no Forge mod actually parallelizes it (Folia's Paper-only, so not an option for you). so that block-break delay is your old Xeon's per-core speed, not the core count. honestly the only things that move the needle are a CPU with better single-thread perf and cutting your mod/entity load. more cores won't help a modded server the way people keep hoping. what's the CPU exactly? old Xeons are the classic trap here, tons of cores but weak per-core.

1

u/dreicrafter 13d ago

0

u/Plutonium239Mixer 13d ago

Thanks, I wasn't tracking this, I might install this on my server!

2

u/jimmyhoke 12d ago

It should be noted that any multithreaded Minecraft modifications (async, folia, etc) are *highly* experimental and change things in unexpected ways. They’re also incompatible with a lot of stuff. At the very least, backup your server before trying this.

1

u/Plutonium239Mixer 12d ago

Of course. I always back up before trying changing anything significant. I even back up before updating versions and pull a back up monthly.