A lot of lag when a lot of items change at once
pkmnfrk opened this issue ยท 10 comments
Issue description:
When a lot of items change at once, it causes a lot of lag on the client side
What happens:
In the context of my mod (external EMC-based storage, see #1979), whenever EMC changes, the items that I expose all recalculate how many items you could craft. This means that potentially hundreds of items can change quantity at the same time.
If you have a terminal open when this happens (and, since extracting an item through a terminal will affect your EMC as above, this is fairly common), then you get anywhere from 1 - 30 seconds of lag on the client side.
It appears as though each item change generates a packet, so the server effectively DOSes the client when this happens.
What you expected to happen:
No lag, maybe one big packet that contains all the changes.
Steps to reproduce:
- Set up as in #1979
- Add a Tome of Knowledge to your Transmutation Table
- Extract a large-valued item via a terminal
Version (make sure you are on the latest version before reporting):
- Minecraft: 1.12.2
- Forge: 2732
- Refined Storage: 1.6.4-279
Does this issue occur on a server? yes
I might take a stab at fixing this, since I have a pretty good test set up already...
The packet is already combined. This is the reason why project e support was removed.
I beg to differ. The packet is only combined in certain circumstances. See my pull request (which I was just a few seconds late on creating). The changes I added completely fix the lag problem
Just to clarify:
The packet is already combined
This is not true in External Storage (which is the context this is in). I can provide more proof that this is the case if required, but it was absolutely 100% triggering a flood of packets before my patch, and absolutely 100% not afterwards.
Can you link proof in an external storage context? Storage caches have a "batched" argument and a flush method.
Yep, they do, which I used in the code I linked to in the other bug. Give me a few minutes, and I'll get some data for you.
So, I added logging to a few places within Refined Storage, and tested both without my patch and with, and collected the logs here:
https://gist.github.com/pkmnfrk/27b8c0c46acb282597b1af4bf34fd474
My test setup isn't complicated, but here it is just in case: https://imgur.com/a/euQOACR