Geolykt / EnchantmentsPlus

Enchantments+, a Bukkit Custom Enchantments Plugin based on Zenchantments targetted at production grade servers
GNU General Public License v3.0
38 stars 15 forks source link

Pretty laggy? #81

Closed Restland closed 3 years ago

Restland commented 3 years ago

After the latest update I have some issues with the TPS image

Geolykt commented 3 years ago

Hello. Thank you for giving me a snippet of a timings report. However due to the architecture of the plugin, it is virtually useless and leads to more harm than good if I were to try to find the cause. Instead, it would be good to give me a spark (or any other semi-decent profiler/sampler) report as it allows me to see the exact origin of the lag.

I hope you understand

Restland commented 3 years ago

What exactly do you want me to send? Thanks in advance.

Geolykt commented 3 years ago

Basically, install the spark plugin (if you haven't already), then do /spark profiler and after a while (just a few minutes) /spark profiler --stop (bonus points if you are in a currently low-TPS situation as that will increase the chance of finding something). Then you will get a link like https://spark.lucko.me/InZzonmHwh (very similar to the usual timings). Since spark exposes some data that you don't want to get exposed, it is also valid on clicking on view: all to get to the sources view and uncollapsing the entries where enchantmentsPlus is responsible and screenshotting that to send it here

Restland commented 3 years ago

Alright will do that tomorrow with the daily restart there are tons of people online right now so I don't want to do an emergancy maintance. Thank you. Will provide all the spark timings tommorow.

Geolykt commented 3 years ago

understandable.

Restland commented 3 years ago

image Hope that helps, if you need more let me know!

Geolykt commented 3 years ago

It would be best if you were to uncollapse the largest source recursively until the call tree becomes too large. Right now I have little knowledge of what the original cause is

Restland commented 3 years ago

image

Geolykt commented 3 years ago

Ah I can work with that. Would be nice if you were to uncollapse the tracer entries a few more times, as otherwise I might fix the "wrong" mistake

Restland commented 3 years ago

I edited it.

Geolykt commented 3 years ago

Okay, that will be a bit harder to resolve. I'll see what I can do however

Restland commented 3 years ago

let me know what else can I do to fix the issue aswell. My server is hosted with Minehut and I can't update the plugin whenever I can they have to do it so. Thanks!

Geolykt commented 3 years ago

Sadly there isn't much you can do. And looking at the problematic code I don't think that it will be easy to fix for me (and will require testing as the fix will likely involve reducing the frequency at which the tracer method is called). One thing you can do however is to reduce the power of the tracer enchantment or to remove it entirely.

Restland commented 3 years ago

How much power would you suggest?

Geolykt commented 3 years ago

No idea to be honest. I can give the tip that halving it should make the lag a quarter less potent (to some degree, the range is increased by 2 later on).

Currently the formula for the range (radius) is Math.round(level * power) + 2 - the higher it is the more lag there should be

Restland commented 3 years ago

Thank you so much. The power was 4 I lowered it to 2 hopefully that will fix the issue.

Geolykt commented 3 years ago

oh yeah, that explains to why you have such issues with it. Still going to optimize the method though

Restland commented 3 years ago

I never changed it tho, pretty bazaar. Thanks again.

Geolykt commented 3 years ago

then your probably changed the max level

Restland commented 3 years ago

You are right. I change the power to 0.3 now , it was 1.