Tech Reborn

Tech Reborn

30M Downloads

Continuous BlockEntity Syncs for TR Machines

shartte opened this issue · 5 comments

commented

Describe the bug
TechReborn machines seem to send continuous BE Sync-Packets, even if the machines are idle. This leads to TR making up the large majority of BE update traffic in my base. The following screenshot shows a measurement of (uncompressed) BE Update Packet sizes received by type of BE that received the packet.

Screenshots
grafik

Environment (please complete the following information with the version):

  • Minecraft: 1.16.2
  • Mod Loader: fabric
    TechReborn-1.16-3.5.2+build.local.jar
commented

No more comments or feedback from original author, archiving.

commented

Nice find. This isn’t really something I have ever looked at. Is this tool public so I can use it to help debug/measure any improvements?

commented

It's still in development and takes a bit to setup (the graphs are from https://grafana.com/ with a https://prometheus.io/ backend to store the timeseries, and a mod to export this data into that toolchain).

Best way to debug it is really putting a BP into BlockEntityUpdateS2CPacket's ctor while standing next to an idling machine.

commented

This should now be drastically better than it was before.

I dont think its perfect so im going to leave this issue open. Please let me know if my recent changes have helped. Many thanks.

commented

I have more details about this: the sync packet for an empty industrial centrifuge is 2936 bytes! (of which 2698 is the slot config!)
image
The entire block entity data for machines is synced to the clients every second, as can be seen in the RecipeCrafter, for a total of 24kbps per machine!!!

For me, the solution is:

  • using BlockEntityClientSerializable to sync stuff that is necessary even when the machine is closed, I'm not sure there is any if you are using blockstates.
  • using custom sync logic to sync the whole block entity when the gui is open, handled by a ScreenHandler.
  • making setIsActive not re-send a packet if the machine wasn't active already, or something like that. This one is the easiest, but the other two are necessary in situations where there are a lot of updates.
  • using a more efficient format for storing slot config.

It's quite a bit of work, but I think server admins will thank you for it. 😁