Mark-225 / BlueBridge

MIT License
19 stars 6 forks source link

BlueBridgeCore with WorldGuard - High Performance Usage #4

Closed colaman90 closed 3 years ago

colaman90 commented 3 years ago

Hi Everyone,

we are using BlueMap (Version 1.5.0) with your Plugin BlueBridgeCore and BlueBridgeWG (Both Version 1.2.1).

In our timings report we saw a very high usage from BlueBridgeCore. Our WorldGuard File contains about 1000 Regions. We set the UpdateInterval to 1200 Ticks, that should mean, every 60 Seconds Update. This Update isn't scheduled as Asynchron Task, so the CPU Usage from Core 1 is during the Update at a peak from 100% for several seconds. This leads to a significant TPS drop during the Update.

In the timings Report here you can see the high usage of 97% usage of all Plugins. Is it possible to Update the WorldGuard Region asynchron or only event-based? It doesn't make sense so import the whole WorldGuard File every 60 Seconds, but if we create a new Region, we don't want to wait until next server reboot or every hour to Import.

BLueBridgeCore

If you need any further Details, please let me know.

Kind Regards Cola

Mark-225 commented 3 years ago

Yes that is something I anticipated as a potential performance issue with WorldGuard.
The problem with WorldGuard was that I couldn't find any events or hooks for region creation and updates when I was creating the addon. Because of that, I now have to fetch every single worldguard region on every update interval. I also can't use async tasks for this approach, because I'm fairly sure WorldGuard's methods to retrieve regions are not thread safe.
Thanks for confirming that this is indeed a big issue with that many regions. I will look into it and keep you updated!

Mark-225 commented 3 years ago

Good news: Turns out a good portion of region retrieval can be made async for WorldGuard, but I have to redesign a lot of the update task to make that work efficiently. And while I'm at it, I planned to redesign the update task anyways to better account for region plugins that do provide events or hooks for their region updates, so I'll probably combine that into one single update.
I might be able to finish it tomorrow/in the next few days, but I won't give any guaranteed ETAs. It hopefully shouldn't take more than a week at max, though.

colaman90 commented 3 years ago

That sounds really great - thank you very much!

Mark-225 commented 3 years ago

Alright just a quick update: I now have a working build of BlueBridge with async region fetching. Actually releasing it will require some more testing and a few changes on the GriefPrevention addon, but the WorldGuard addon could work fine already. No guarantees though, so if you want to test it, I don't recommend doing so on a production server.

You can download the build here: https://github.com/Mark-225/BlueBridge/pull/5/checks?check_run_id=2824009629
(Just click on artifacts, download the zip and unpack it to get the jar files)
If you do test it, I would appreciate some feedback on bugs and performance. I will probably work on a stress-test server in the future but right now I don't have an easy way to test with the amounts of regions you are using.

colaman90 commented 3 years ago

Hi, i tested the new Plugin version for 2 Days on our development Server.

From my side, the performance is Significant better then before. Actually no bugs or issues.

BLueBridgeCore_update

If you need a WorldGuard File with about 1000 entrys - we can try to anonymize them and then we can send it to you if it help! :)

Thank you for your fast Rewrite!

Mark-225 commented 3 years ago

Thanks for the feedback, glad to hear it works for you :)
If the anonymization doesn't require too much effort on your side, I'd definitely appreciate the region file so I can test the update on a more realistic scenario.

Mark-225 commented 3 years ago

Okay another status update:
On my part everything is ready for the update and the GriefPrevention addon has been adjusted to work reliably but I found a bug in BlueMap that would make my plugin really unstable when running both WorldGuard and GriefPrevention addons simultaneously. That bug is already reported and will be fixed in the next release, so I will wait with BlueBridge's 1.3 release until the next BlueMap version is released.

colaman90 commented 3 years ago

Perfect, thank you for your update!