Blackixx / BossShopPro

BossShopPro is one of the most player-friendly and multifunctional GUI plugins ever! Say goodbye to all the annoying command- or signshops!
https://www.spigotmc.org/resources/bossshoppro-the-most-powerful-chest-gui-shop-menu-plugin.222/
MIT License
43 stars 63 forks source link

/bs reload takes 7-10 entire seconds and causes lag #106

Open Diamondback88 opened 3 years ago

Diamondback88 commented 3 years ago

Executing /bs reload causes the server to freeze for 7-10 seconds while BossShop reloads, and then TPS takes a hit from 20 to about 18 or so. Nothing extra prints in console besides "Can't keep up! Is the server overloaded?", etc.

I also only have about 15 shops, and none of them are massive in any way. Not sure why it's taking so long to reload the plugin.

Blackixx commented 3 years ago

Hm, there are many possible root causes for this issue. What comes to my mind right now: BSP does support many other plugins and does hook into them. For example, it does support other points plugins (like PlayerPoints). Now, those points plugins could store their data in another data base, which might take some time to access, or it could simply not be optimized or there is too much data stored. Now, if BSP accesses points via that points plugin, this will take some time. The same holds true for any other content offered by external plugins. Let's take placeholders, for example: if you have a server count placeholder, for example, or a Mcmmo placeholder or whatever other placeholder, the time it takes for BSP to load the corresponding shop simply depends on the time it takes for those connected plugins to do their stuff. Therefore, depending on what other plugins you use, BSP can be either very fast or also slowed down a lot. BSP by itself should be rather fast, except you use a lot of player skulls/heads: those also can take some time to load.

cloakfox commented 3 years ago

Having same issue, it's because of the player_heads / skulls

Edit: from personal experience and the the items we have in our menu's I think its player heads/skulls.

Diamondback88 commented 3 years ago

I removed the player skulls from the only shop I've edited since I've noticed the reload time getting faster, and the reload still takes the exact same amount of time. Not quite sure how to debug this - is there a plugin debugger?

Diamondback88 commented 3 years ago

Ran a spark profiler - even without the heads here, inside of addShopItem(), Thread.sleep() is taking up 20%(!) of tick. image

This same thing happens inside of createBuyItem(): image

Diamondback88 commented 3 years ago

Update: I have determined that any player skull that uses the %name% placeholder to determine the look of the skull is the sole cause of the lag. Removing it in all shops that used it eliminated the lag entirely.

I've tested this on a barebones paper server as well, with no other plugins and no config file changes other than my bossshop shops.

mercurialmusic commented 3 years ago

Update: I have determined that any player skull that uses the %name% placeholder to determine the look of the skull is the sole cause of the lag. Removing it in all shops that used it eliminated the lag entirely.

I've tested this on a barebones paper server as well, with no other plugins and no config file changes other than my bossshop shops.

Confirming this. Was getting some massive lag on reload and frequent BS plugin crashes, removing that placeholder fixed all my problems. even the %displayname% placeholder is fine, it's specifically %name% causing problems.