Refined Storage

Refined Storage

77M Downloads

Performance

mrjoes opened this issue ยท 4 comments

commented

Issue description:

Refined Storage is slowing down a fairly perfomant server with a relatively large RS network (dozens of exporters, importers, crafters, etc). I also have fully-upgraded void miner (environmental tech) pumping items into the network via interfaces, ore is automatically processed using various mods, etc. Just in case, the RS is a part of the All the Mods 3 modpack.

I'm not very familiar with the source code of this mod, but one thing was interesting - most of the time was spent in the invalidate() function and I'm not sure why my network is rebuilding on almost every tick.

It's very possible that the network is running out of power and turning on and off, but it's hard for me to test that at the moment - client just times out. Even with a stable power supply, invalidate() took most of the time when items were inserted or removed from the network.

See attached profiling log.
2.zip

What happens:

Server is less than 1 TPS (0.36) on an overclocked i7-4790k.

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

  • Minecraft: 1.12.2
  • Forge: 14.23.4.2175
  • Refined Storage: 1.5.34

Does this issue occur on a server? YES.

commented

The network is constantly turning on and off, thjat is the problem.

Even with a stable power supply, invalidate() took most of the time when items were inserted or removed from the network.

I need a profiling report for that too then.

commented

Sure, here's the updated dump. Point of interest is the invalidate() method that's called as a result of onChanged handler in the following functions: StorageCacheItem.remove() and StorageCacheItem.add().

I'm not sure if that's a feedback loop - I have quite a few quantum storage units and it seems to invalidate the cache if the qty of the items changed in a storage unit. So inserting/removing item from the external storage invalidates the cache and I have quite a few items in my network so it takes a while. Just in case, these quantum storage units are not hooked up to anything but RS external storage bus.

5.zip

P.S. The reason why it was recalculating the network was different. One of the players had part of the network chunk-loaded. Whenever he logged in it would chunk-load the other part of the network and cause the lag.

commented

You are drawing the wrong conclusions here, please stop assuming things when you haven't properly read the code. No, it doesn't invalidate the entire cache if an external source changes:

https://github.com/raoulvdberge/refinedstorage/blob/mc1.12/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/storage/externalstorage/StorageExternalItem.java#L67-L102

It only updates the changes, but never invalidates entirely.

It only invalidates when the storage is removed or added to the network.

Also, your profiling report doesn't mention invalidate(), so I'm not sure what you are talking about.

(Also - never is there a listener being added to the storage caches that invalidate it)

commented

Duplicate. Please ignore everything above, it was fixed by this: 3124e3d

The latest release was few days earlier and does not have the fix.