Integrated Dynamics

Integrated Dynamics

63M Downloads

Lag when using large amount of chests in a storage system

stefmmm opened this issue ยท 9 comments

commented

I'm running a valhelsia 5 server for me and my friends and one day i got complaints about serious lag,

upon checking the console i saw a bunch 'Can't keep up!' alerts and decided to investigate further,

after checking the profiler i quickly noticed IntegratedDynamics was the top offender,

My friend told me he's using about 50 vanilla chests, 30 balanced crates, Connected via logic cables and item interfaces to the storage terminal.

Issue type:

  • ๐ŸŒ Performance issue

Short description:

Massive server-wide lag

Steps to reproduce the problem:

Make a storage terminal, make a bunch of chests and connect them using logic cables and item interfaces


Versions:

  • This mod: 1.19.2-1.16.4
  • Minecraft: 1.19.2
  • Forge: 43.2.10

Profiler output:

https://spark.lucko.me/w4ZfdhIWjr

commented

Thanks for reporting!

commented

Could you enable the ID network diagnostics (/integrateddynamics networkdiagnostics to check if all item interfaces cause lag, or just a single one?
If the latter, it might be sufficient to just lower the tickrate of that single interface.

When looking at the stacktrace, it looks like a significant chunk of lag is coming from net.lettuce.balancedcrates.block.entity.OpenMangroveCrateBlockEntity.getSlotsForFace(), which may be not be implemented as efficient as it could be. (given the apparent repeated arrayification and copying)

commented

It's all of them and it looks like they are item exporters, with an average ticktime of 14 and a max of 45
when selecting the culprits in the network diagnostics they show up like this https://imgur.com/a/fY8r1Uk

Imgur
Discover the magic of the internet at Imgur, a community powered entertainment destination. Lift your spirits with funny jokes, trending memes, entertaining gifs, inspiring stories, viral videos, and so much more from users.
commented

What is happening exactly in those specific item exporters? What aspect are you configuring? How frequent are items passing through there in practise? What machines are they targeting?

commented

I asked, they are set to export bio fuel into the machines, they are mekanism pressurized reaction chambers, i cant exactly see how frequently items are passing through but when the machine is working i'm guessing it's constantly doing so.

commented

At this point, I don't see anything really wrong in the ID-side.
As shown in the profiling log, the majority of ticktime originates from net.lettuce.balancedcrates.block.entity.OpenMangroveCrateBlockEntity.getSlotsForFace(), as mentioned before:
Screenshot 2023-07-07 at 16 29 24
So I suspect that there's a sub-optimal implementation of the balanced crates mod, so it might be interesting to try switching to a different storage mechanism and/or reporting this issue to the balanced crates mod.

Also, are you aware of the possibility to lower the tick rate of item exporters (like with any ID part)?
This can be configured in the part settings when right-clicking on it.
This might be a good interim solution until the root cause of the problem is fixed.

commented

I'll ask my friend to switch to a different storage mechanism to see if that helps,
also i was not aware you could change the tick rate of item exporters i'll check that out in the mean time.
i just checked, the item exporters are set to 1 ticks/operation and thats the lowest it'll go

commented

@stefmmm I think to lower the tick rate you set the ticks/operation to a higher value. 20 ticks/operation should limit it to once per second.

commented

We were getting insane amounts of lag from some other Mekanism machines exporting stuff, Disconnecting the crates from the system has eliminated all lag!