Use coordinate-based locking to increase chunk system parallelism #74
No reviewers
Labels
No labels
documentation
good first issue
help wanted
resolution: duplicate
resolution: invalid
resolution: won't fix
status: needs triage
type: bug
type: feature
type: performance
type: question
version: 1.19.4
version: 1.20
version: 1.20.1
version: 1.20.2
version: 1.20.4
version: 1.20.6
version: 1.21.11
version: 1.21.4
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Minecraft/Folia!74
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "dev/locking"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
See patch notes for implementation details.
This patch should massively increase performance in Folia due to the significantly better locking behavior.
As with mainline Folia, builds are not provided you must build it yourself. If you already know how to build regular Folia, just use
your git client to checkout to the dev/locking branch (and please verify via current HEAD that you have the latest from the branch).
Please report any issues with this branch on this PR.
I did a bit of testing with this branch and bots joining + spawnRadius = 50k. Chunk loading seems to be smoother, which is nice.
However, in two out of three tries the server completely locked up after about 10 minutes.
For some time before that /tps showed a different region at ~2 TPS every time I ran it. After some time, one region apparently completely died, showing up at 5000 mspt.
after this it was also no longer possible to join (even though I was in a different region).
jstack dump of the unresponsive server
How many regions? You may have hit the scheduler's limit.
Well, 5. Which is also seems off considering its 194 bots with spawnradius 50k.
I have reverted the change to the region shift, please try again.
Did three tests again, no locking up. Highest mspt is at 14ms. Region count also seems a lot more plausible now, and gen rate went up massively. I guess that revert helped.

Got this on previous built, from 19h ago, might help.
log
I can only see this happening if you have a plugin used the regenerate chunk API. Is this the case?
Hi Leaf, I don't have any plugins generating chunks.
This test ran with minecraft-stress-test connected, simulating players
BTW on current built I got these controlled errores:
"[20:30:48 ERROR]: Detected setBlock in a far chunk [-126, 408], pos: BlockPos{x=-2013, y=31, z=6540}, status: minecraft:features, currently generating: ResourceKey[minecraft:worldgen/placed_feature / minecraft:large_dripstone]"
"[21:14:34 ERROR]: Failed to fetch mob spawner entity at (-3540, 21, -529)"
I have reviewed the stacktrace again only to find that the line number on ImposterProtoChunk does not match what it should.
It looks like the diff I inserted there to prevent this crash is not on your Folia build, even though the commit # indicates it should be. Can you re-run applyPatches, and make a new build and test again?
This branch seems stable enough for Folia, so I'll merge it now.
Might have missed a step in the built, anyway the last built from this branch did not produce any problems besides the one I last posted, all controlled.