Refined Storage

Refined Storage

77M Downloads

Client locks up when searching the crafting grid. Server OK, TPS is fine

yurikus opened this issue ยท 4 comments

commented

I can provide you with a world to help debug this issue. I understand why this is happening, you might be interested to look at it, because my setup surfaces performance issue. This is a client/sever setup, server is running on a separate box.

TLDR: client deadlocks (or just starves on a lock) during crafting grid search due to high-speed frequent modification of storage contents by importers and exporters.

Background:
I have 3+ Billion milli-buckets of different fluids in storage as well as 50+ million items. Everything goes through the storage. 4x Tier 6 void miners, multiple stacks of Sag Mills and Resourceful Furnaces. If I forget to turn off the void miner farm, which also disconnects Sag Mill stack via RS Relay, client reliably locks up and I have to terminate the process.

I'm available to provide you anything you need to diagnose the issue, including cleaning up and minimizing the modpack I customized from DW20's one and making the world available for you as well.

commented

I allowed myself to quickly scan through the source and first obvious place to look would be grid sorting code. It might be possible to avoid making a copy of all item stacks and running the filter predicate directly on map.values() with a lock around it if necessary, then adding the items passing the filter to the stacks list, thus avoiding a large (multi-million item) copy.

https://github.com/raoulvdberge/refinedstorage/blob/06a762022c048d148bb6f4611b3fb1916bf7ccd6/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/view/GridViewBase.java#L39

https://github.com/raoulvdberge/refinedstorage/blob/06a762022c048d148bb6f4611b3fb1916bf7ccd6/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/view/GridViewBase.java#L54-L56

Biggest issue I'm experiencing is with @modname searching. It reliably locks up the client when items are added and removed from storage at roughly 1000/s inbound and 200/s outbound.

EDIT: I thought about it some more and I would suggest two optimizations:

  1. See if you can avoid extra copy in the code above
  2. Delayed-type-ahead filtering. This is how I dealt with filtering large lists before. You delay run your filter predicate about 250ms after last key press received. This way when user types fast enough, you get to do only one filter operation. This is what locking up the grid for me.

One more thing: Add Unsorted "sorting style", only filter, don't sort.

commented

You really need to follow the issue template.

commented

My apologies, it was much more intuitive in a free-form way. I understand the people bug you with their wants all the time and you can't spare the light of day for some, I really do .. (25 years coding ...) However it is really not necessary to behave in such a dismissive and patronizing manner as multitude of responses to valid questions show.

commented

Me asking to fill out an issue report correctly is NOT dismissive and is for sure NOT patronizing. So please fill it out before we continue. The issue template provides me with context about version information and other important things.