Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Lag spikes when crossing chunk border #83

Open
Krimsar opened this issue May 28, 2022 · 11 comments
Open

Lag spikes when crossing chunk border #83

Krimsar opened this issue May 28, 2022 · 11 comments

Comments

@Krimsar
Copy link

Krimsar commented May 28, 2022

I have rather noticeable lag spikes when crossing chunk borders. As far as I can tell, it happens on any chunk border, no matter the (visible) geometry.
When I disable phosphor, the spikes get a lot less pronounced. I have screenshots attached, but can also provide video if needed.
Mods I'm using:

  • sodium-fabric-mc1.18.2-0.4.1+build.15.jar
  • lithium-fabric-mc1.18.2-0.7.10.jar
  • phosphor-fabric-mc1.18.x-0.8.1.jar
  • fabric-api-0.53.4+1.18.2.jar.

The only other mods I'm using are BetterF3-1.2.4-Fabric-1.18.2.jar and modmenu-3.2.2.jar, but disabling them doesn't change the behaviour.

With phosphor-fabric-mc1.18.x-0.8.1.jar
with
Without:
without

@PhiProven
Copy link
Member

Thanks for the report. I'm not really able to reproduce these spikes, so I have to ask you to do some further testing for me.
There are some known issues where better chunk loading speed can lead to fps spikes due to the client having to process larger batches of information at once. These kinds of issues are a bit hardware dependent and hence somwhat inconsistent to reproduce.

Can you please set up a local server and try out all four combinations of Phosphor/Vanilla Client/Server (using the same world, position, etc. so the results are comparable) and post the results here? In view of the mentioned issue, im particularly interested whether toggling Phosphor on the server while using a Vanilla client has any effect.

@Krimsar
Copy link
Author

Krimsar commented Jul 8, 2022

Okay so I finally got around to testing this out. I get no spikes when I'm using a local server (in all combinations) as far as I can tell.

Only seems to be a problem when running the server in-process :-/

edit: I also used 1.19 for the testing

@ProNoob135
Copy link

ProNoob135 commented Aug 18, 2022

Getting this quite severely on both multiplayer and singleplayer, specifically when phosphor is installed on the client(I've tested all four combinations).
Happens with phosphor alone and when used with sodium/lithium/everything else.
It's directly correlated to render distance, at 6 it's essentially imperceptible, while at 32 it's quite frustrating.
I'm running AMD/AMD (Linux), so it's atleast not specific to Intel/NVIDIA.
Happens on both Fabric and Quilt(unsurprisingly)
Low render distance(spikes are there, but not noticeable in gameplay)
2022-08-17_23 24 30
32 render distance(spikes are debilitating)
2022-08-17_23 23 32
Tell me if there are any tests I can contribute.

@PhiProven
Copy link
Member

Thanks for the info. Your results suggest that the issue is not caused by the increased chunk loading speed on the server.
I will have to look into it in more detail, but I can't tell yet when I have the time to.

@PhiProven
Copy link
Member

Actually, there is some testing you can do.
Please run the client profiler (shift + F3, i.e., the pie chart). During the lag spikes, a notification should appear in the console, saying that something took too long. After closing the game, you can find these in the log file. Can you please post these notifications here? If it's always the same few entries popping up, it suffices if you post those.

@TheUserCreated
Copy link

TheUserCreated commented Sep 13, 2022

Here is my log from the same issue https://mclo.gs/RFEPmiH
20220913174049_1
and here is a pie chart
does not occur with starlight instead of phosphor

@PhiProven
Copy link
Member

Thanks for your help.
Unfortunately, your log doesn't contain much useful info; most entries are just root. Can you please run the profiler again including this mod (source https://github.com/PhiPro95/mc-fixes/tree/profiler-threshold)? This should improve the sensitivity of the profiler for nested entries.
Also, please run the test over an extended period of time (several minutes), so we can get enough data points to distinguish them from random noise. However, do not try to force lag spikes by flying around too fast, or something like that. We want data on this specific stuttering and not just overall bad fps.

@TheUserCreated
Copy link

I tried to make this test as reproducible as I could, seed was 1378003740600832149

First, I joined the game and waited a full 10 minutes for things to stabilize
2022-09-16_01 03 16
Afterwards i stepped onto a contraption that teleported me between the same 4 chunks repeatedly and let that happen for 5 minutes, taking a screenshot halfway through and at the end of the 5 minutes
2022-09-16_01 06 27
2022-09-16_01 08 48
Then I flew manually between the 4 chunks for 3 minutes, a screenshot halfway through and at the end as well.
2022-09-16_01 10 23
2022-09-16_01 11 56
And here is the game log; https://mclo.gs/0XU9sFF

This test was done on a different machine than the last one I sent from but I made sure the issue still occurred on it.

@PhiProven
Copy link
Member

Sorry for the very late response; I have been a bit busy lately.
Can you please run the tests again with this version of Phosphor (Source: https://github.com/CaffeineMC/phosphor-fabric/tree/1.19.x/profiling), together with the above profiler-threshold mod. This adds additional profiling entries in order to further break down light_updates and pin down the issue.

@TheUserCreated
Copy link

TheUserCreated commented Nov 6, 2022

Here you go; the timings for the test were not identical but the world and setup was. Do note the lines showing a change in settings, as I was having trouble reproducing it on a lower render distance this time. It's more severe the higher ones render distance is, at max its almost unplayable when moving between chunks
https://mclo.gs/QM390l3

@PhiProven
Copy link
Member

Thanks for your help.
The issue pointed out by these logs is a known weakness of Vanilla's distance propagation algorithm which is currently not tampered with by Phosphor. This primarily shows up when unloading chunks.
However, since you forcefully put the engine under stress by teleporting around all the time, some amount of lag is to be expected. It would be helpful to also get a similar profiler log for the spikes occurring sporadically in more natural situations, like in the original reports. In those cases, the original reports claim a regression of Phosphor vs Vanilla, so the log should hopefully show something Phosphor actually modifies.

Best,
PhiPro

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants