Tuinity / Moonrise

Optimisation mod the dedicated/integrated server.
https://curseforge.com/minecraft/mc-mods/moonrise
GNU General Public License v3.0
141 stars 6 forks source link

[Issue] Lag spikes in rendering thread #27

Closed NXTler closed 1 month ago

NXTler commented 2 months ago

I'm currently creating a performance Modpack and during testing with Moonrise I noticed large lag spikes during chunk generation/loading. Taking a look at F3 + 2 profiler, I noticed that Moonrise sometimes seems to utilize the rendering and the client thread, causing stuttering. My suggestion is to maybe blacklist the client and rendering threads to prevent this from happening.

jpenilla commented 2 months ago

Better thread management than vanilla is already part of the mod, it reduces frame spikes when generating/loading chunks by reducing vanilla's overallocation of threads to chunk gen and background tasks (see the render and util_thread_counts mixins). However, some of this is undone when Sodium is installed. #29 should fix the frame time spikes you were noticing. I'm also not quite sure what you mean by the suggestion in the last sentence.

NXTler commented 2 months ago

I did test the mod with just FabricAPI and ModMenu installed, which shouldn't affect anything, and I was still observing large lag spikes on the rendering thread. I also tested the mod with VulkanMod, which shouldn't modify threading in any way, to rule out lag spikes from chunk loading and a very similar behavior was observed. Please excuse my very bad phrasing in my previous suggestion. I essentially meant that using the rendering thread for chunk generation, I/O, ect. should be avoided to reduce these lag spikes.

Skullians commented 2 months ago

Do you still experience the same issue without moonrise…?

NXTler commented 2 months ago

No, it's only happening with Moonrise installed.

NXTler commented 1 month ago

I created three videos to better showcase the issue. The first one is just vanilla, the second one is just Moonrise and the third one is VulkanMod with Moonrise to rule out chunk loading issues. For Vanilla and VulkanMod I also used F3 + A to show the effect of chunk loading on frame time, but the beginning is a bit cut off for some reason.

https://github.com/user-attachments/assets/6cce5e81-8272-4034-80db-a1d6e623955c

https://github.com/user-attachments/assets/b49715f5-457f-42b9-8f69-3b4b9f7f33c0

https://github.com/user-attachments/assets/a4a4765d-1181-4415-b6f5-710277ba3d42

NXTler commented 1 month ago

Any clue what might cause this?

kennytv commented 1 month ago

Chunks aren't generated on the render thread, what jmp was referring to is bad thread management taking away processing time/threads from other things. He also made #29 to reduce light processing load

NXTler commented 1 month ago

I see, thanks for the insight.

NXTler commented 1 month ago

I just tested the dev artifact and it seems to fix the issue. There are some spikes, but these might as well be from the rendering chunk builder. This can be closed once the pull request is merged.

jpenilla commented 1 month ago

https://github.com/Tuinity/Moonrise/commit/fef4872a3ae504439eee73ff0b0b91633d20764e Will be fixed in the next beta release, or if you download the latest actions artifact.