Supplementaries

Supplementaries

82M Downloads

High TPS jitter on supplementaries-1.18.1-1.1.2

ohnx opened this issue ยท 8 comments

commented

I run an "All The Mods 7" server and Supplementaries seems to be one of the mods in this pack. Recently, I've noticed some high jitter in the TPS on the server.

Version info:

Forge: 39.0.9
Minecraft: 1.18.1
Supplementaries: 1.1.2

Spark profile available here: https://spark.lucko.me/XKl7UbT7MW

Reading the trace, it seems that the cause of this issue is very similar to another one that I encountered with a different mod, tracked here: Ellpeck/NaturesAura#235

I guess level.getChunkSource() takes a long time to run sometimes (maybe it's doing a disk read?), and that results in a very high TPS in those cases.

The patch that that mod-maker used is this: Ellpeck/NaturesAura@13e6307...87d0804

commented

Can you try that again but using the latest version?

commented

Awesome, so it was indeed that weird cap synching I had. Let me know if you find more even slight performance issues. I rarely perform those kind of tests cause I dont have a server so stuff like that can pass under the radar

commented

I've also been having terrible performance with Supplementaries on my server.
Did two spark reports, one with it enabled and another with it disabled.
Both tests on different brand new worlds, as soon as I connected to the server I started the profiler and started running in a random direction to keep generating things. With Supplementaries enabled I'd experience bad server performance and get my position in the world "rolled back" over and over again while running. Massive abnormal tick increases as well (from /spark tickmonitor). With it disabled I didn't experience that anymore.

The person who analyzed the first report said the following:

supplementaries is having a threadlock
waiting for something to happen and blocking things
must be running on a different thread, blocking the main thread

and after analyzing the second report:

yep something from that is taking a long time to execute something

Version tested:
supplementaries-1.18.1-1.1.7.jar with selene-1.18-1.11.jar

commented

ok so could you put me in contact with whoever analized that? Usually the whole point to run stuff on a diff thread is not to hang up the main thread so that doesn't make much sense to me. For example in the past I got many reports of long ticks happeing when generating way signs cause the locate command was slot and they need to search for villagers. I solved that by putting all that code on a diff thread so they generate without anything and get added wherever that thread is done.
From what I can see by searching that profile is that most of that stuff can be lead back to my chunk watch event, a recent addition that was needed to sync capabilities. I'll investigate. Could you confirm that the lag you saw indeed comes from that ServerEvents.onPlayerStartTracking? I'm not that experienced with reading those profiles so do tell me if there are other calls worth looking at. Also note that that event is slower the faster you generate chunks as it needs to send more stuff. Shouldn't be as slot as it seem to be there but usually running around generatings a bunch of chunks slows everything down

commented

maybe I identified the issue. that method itself is kind of slow and not ideal (waiting for forge to push some pr before a proper sulution can be found) but shouldn't be that show. I was indeed asking the server to run a task after a tick but it was instead making it wait one, at least that's my hypothesis

commented

ok so could you put me in contact with whoever analized that?

I can't, join the spark discord and search for that report, you'll find the guy analyzed it. As far as why that piece of code is being a problem I couldn't tell you because I never really studied Java.

Could you confirm that the lag you saw indeed comes from that ServerEvents.onPlayerStartTracking?

The only thing I can confirm is the server running much better after disabling the mod not only during chunk loading but also overall, less tick delays and dramatically less "rollbacks" (I'm connecting to my server in LAN).

commented

I found a different way to handle that syncing code. I'll upload soon so would be cool if you could compare it

commented

Tested supplementaries-1.18.1-1.1.8.jar and it looks promising, "rolled back" only once while exploring a nice bit of the fresh world (probably because of other mod) and in the spark report you can see by clicking the eye icon how significantly lower the time (?) taken by the mod is.
Seems good so far, if I notice anything weird I'll let you know. Good job.