BentoBox icon indicating copy to clipboard operation
BentoBox copied to clipboard

Bentobox massive lag spike during island removal due to IA custom blocks that do not exist

Open TheLaoming opened this issue 1 year ago • 15 comments

Expected behavior

It shouldn't lag like this. Version 1.24.1 didn't have this problem.

Observed/Actual behavior

When you invite someone and the chosen player already has his island, massive lag will start due to Itemsadder custom blocks (which are not even here). I'm not even use any custom blocks, there's literally that one AOneblock block.

Steps/models to reproduce

  1. Install Bentobox 1.20.0 or any dev build + Itemsadder
  2. Make any player to create their island
  3. Invite them
  4. 10 sec lag appears beacause of their island removal

BentoBox version

2.0.1-SNAPSHOT-b2557 with generated addons

Plugin list

Plugins (14): AnimatedScoreboard, BentoBox, Bentobox-AOneBlock, BentoBox-Biomes, BentoBox-Level, BentoBox-Visit, BentoBox-Warps, ItemsAdder, LoneLibs, LuckPerms, ProtocolLib, Vault, ViaBackwards, ViaVersion

Other

Using fork of paper Pufferfish 1.20.2, ItemsAdder 3.6.3-beta-5 and LoneLibs 1.0.43.

TheLaoming avatar Feb 11 '24 17:02 TheLaoming

Use spark and provide us a spark report. It would be better for us to investigate the lag.

HSGamer avatar Feb 13 '24 01:02 HSGamer

Yes, the issue is that when the island is being deleted, the code tells ItemsAdder that the block is being removed, for each block. We had the same problem with SlimeFun, but I was able to fix it because their API has a way to check for blocks. I think I'll temporarily remove the hook so that there isn't lag at the expense of not deleting IA blocks.

tastybento avatar Feb 13 '24 03:02 tastybento

The other option is to drastically reduce the number of blocks deleted in one go in the BentoBox config.yml.

Anyway, I'll try and see if this can be optimized.

You can use the snapshot 2.0.1 version.

tastybento avatar Feb 13 '24 03:02 tastybento

Thanks! Does this also apply to IA furnitures too (especially those using armor stands) or just custom blocks?

TheLaoming avatar Feb 13 '24 12:02 TheLaoming

Thanks! Does this also apply to IA furnitures too (especially those using armor stands) or just custom blocks?

Mostly just custom blocks

HSGamer avatar Feb 13 '24 14:02 HSGamer

I just tested dev build with disabled IA blocks removal, but for some reason it still lags but less than before. I don't remember this was a problem in 1.24.1. Maybe it's something wrong w 1.20.2 mc version? I was on 1.20.1 before. spark

TheLaoming avatar Feb 15 '24 17:02 TheLaoming

Try the very latest build on the CI server. I added NMS support for older versions - before, it would only optimize for 1.20.4, so if you were using 1.20.2, then it would be using the Bukkit API to copy and paste blocks.

tastybento avatar Feb 17 '24 03:02 tastybento

I asked the dev for some API addition to prevent the lag, but let's see. https://github.com/PluginBugs/Issues-ItemsAdder/issues/3445

tastybento avatar Feb 18 '24 16:02 tastybento

Great! Anyway don't know what's going on, I just updated Bentobox to the latest build and addons too, but there's lag when I invite a player. Looks like I have to stick with no island removal for now.

TheLaoming avatar Feb 18 '24 16:02 TheLaoming

Having same issue with purging unowned islands, because I just disabled automatic island removal. It's not really that massive, but probably same lag spike. So currently I have no way how to avoid this lag. Any idea @tastybento ? I've got lag when I purged just 4 islands.

TheLaoming avatar Feb 21 '24 13:02 TheLaoming

I need logs or stats to see where the lag is coming from when you do this. It may be some other location. Can you post a Spark report?

tastybento avatar Feb 21 '24 14:02 tastybento

Here it is, I think it's very similar when I am purging islands. https://spark.lucko.me/VdiF0IHFpV

TheLaoming avatar Feb 21 '24 15:02 TheLaoming

Hmm forgive me but that seems all okay - 20 tps across the board. Although BentoBox does use CPU, the TPS are not affected (at least according to that report). It looks like the staggering system is working. What do you actually experience in game?

tastybento avatar Feb 22 '24 04:02 tastybento

Trust me, it affects TPS too and it's really not a small lag spike, there is no chance not to notice, because you can't even open chests, drop items etc. drop drop2 Just check plugins section in that spark, 98% is crazy, never had more than 20 and it's even measured using a parameter --only-ticks-over 200 which is even more crazy.

TheLaoming avatar Feb 22 '24 13:02 TheLaoming

Okay thanks. Let's see what we can tweak.

tastybento avatar Feb 22 '24 15:02 tastybento

Same problem with 1.20.4, but looks like for example obadmin purge unowned doesn't lag like that, it only takes not even 1 tps. Problem is reset itself.

TheLaoming avatar Mar 11 '24 10:03 TheLaoming