Refined Storage

Refined Storage

77M Downloads

Network graph shouldn't rebuild when power is low

tivec opened this issue ยท 7 comments

commented

Issue description:

Server lag, "Can't keep up! ..."

There is no crash log, but here's a sampler output for it. I had, in between those, up to 28 second behind on the server, and another with 14 seconds. It seems it spent quite a lot of time in com.raoulvdberge.refinedstorage.apiimpl.util.ItemStackList.add(), which seems unnatural for the few invocations (5784 invocations, 57532ms spent).

lag.zip

Another thing i noticed was my system blinking on and off, even though I am feeding it with enough energy (Flux Networks point on the controller, no limit on it).

It worked fine on the same setup on beta4, and nothing was changed (in the world) between updates. Lots of other mods updated in the AllTheMods pack though.

Version (Make sure you are on the latest version before reporting):

  • Minecraft: 1.10.2
  • Forge: 12.18.2.2116
  • Refined Storage: refinedstorage-1.2-beta5.jar

Does this issue occur on a server? [yes/no]
Yes

commented

I don't know where you get the ItemStackList number from, but looking at your NPS file, the lag is caused because the network graph is rebuilding constantly because you are running out of energy:

x

How much RS/t does your controller take and are you sure it can keep up?

commented

Hrm, let me see what is causing that. I am pretty sure my system is fed enough energy, but perhaps there is something inconsistent here with the way that the flux networks work. I'm going to replace the flux point, depower the system completely, and see if it resolves the issue.

commented

Ok, this issue can be closed - the issue is because of Flux Networks and how they transmit power.

commented

The graph shouldn't get rebuilt when power is low though, this is an optimization I can still do.

commented

Ah gotcha :) It can be reproduced if you attach a Flux Networks point to the controller, and set the flux networks controller mode to "even distribution". You might need to have a fairly large system with a bit of energy pull to see this...

commented

Another perf fix is to not send block updates too fast when the system is toggling on and off constantly. It needs a cooldown.

commented
<HenryLoenwind> https://github.com/SleepyTrousers/EnderIO/blob/1.10/src/main/java/crazypants/enderio/machine/AbstractMachineEntity.java#L255-L266
<raoulvdberge> aha thx
<HenryLoenwind> in our case "active" is on the te, not the blockstate. if you need to set a different blockstate server-side, you need to do more adapting
<raoulvdberge> no i'm having something similair
<HenryLoenwind> but the logic should be the same
<raoulvdberge> https://github.com/raoulvdberge/refinedstorage/blob/mc1.11/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/network/node/NetworkNode.java#L94-L101
<HenryLoenwind> btw, thsi delays switching off the "active" rendering by 20 ticks and switching it on by 4
<HenryLoenwind> so short state changes don't force a re-render
<HenryLoenwind> another thing I'd add is that the controller waits for its buffer to be >50% after it runs out of power before it reactivates
<raoulvdberge> so your logic is: - if it's going into inactive mode, only update after 20 ticks. - if its going into active mode, only update after 4 ticks.
<HenryLoenwind> yes, and if the state changes back in that time, reset the timer
<raoulvdberge> cool thx
<raoulvdberge> ideally block updates wouldn't be a fps log....
<raoulvdberge> * hog
<HenryLoenwind> I have different values because that fits a machine that usually is off
<HenryLoenwind> you may want to reverse them, your network is usually on
<HenryLoenwind> yeah, chunk rendering is still too heavy on the fps. even with models
<raoulvdberge> dumping this conversation on github so i remember for tonight
<HenryLoenwind> and offloading it to a second thread