Ancient Gates

Ancient Gates

294k Downloads

Loading gates takes far too long

Capri205 opened this issue ยท 7 comments

commented

Hi. Do you have any idea why the loading gates takes so long on server startup?

[13:35:16] [Server thread/INFO]: [AncientGates] Enabling AncientGates v2.3
[13:35:16] [Server thread/INFO]: [AncientGates] Loading gates into memory
[13:37:15] [Server thread/INFO]: [AncientGates] Enabled (119041 ms)

This was a quick load by most standards and there are only 6 gates defined in the config file - 3 are location to the world and 3 are bungeeto gates to other servers that are up and available. All on the same network. I have seen this take over 3 minutes to process!

If there is a way to debug what it's doing during this time let me know and I will try it out.

This was happening on 1.15.2 and now on 1.16.

Took nearly two minutes to online my lobby following this mornings restart:

9:34:38 AM AncientGates: Loading gates into memory
9:36:25 AM AncientGates: Enabled (107405 ms)

The VM only hosts 3 small lobby servers and is not overloaded (4 cores/12GB)

commented

I did a little testing today and for some reason AncientGates is forcing the generation of a lot of new region files in the server - either at startup (3 ~ 8 minutes) or when configuring a new gate and when opening it will cause a time out as the chunks and regions files are created. There were dozens of new region files generated that shouldn't be there. I ran a quick test by removing all plugins and starting the server with a fresh clean copy of the lobby (just a handful of region files) and no new region files appeared after a few restarts. Adding in the AncientGates with no config (aka fresh install) the plugin also did not cause the creation of new region files. However, a restart after adding in my config with the 6 gates caused the generation of new region files of varying sizes and the loading gates step took 8 minutes to complete, and when creating a third new gate from a fresh clean startup I got a timeout and it created about 12 new region files that are 3000 blocks away from the lobby. Not sure why it didn't generate them on the first two new gates, but it did on the third and caused a timeout.

[15:20:34] [Server thread/INFO]: [AncientGates] Loading gates into memory
[15:28:29] [Server thread/INFO]: [AncientGates] Enabled (475982 ms)

The region files created have no relation to the gate locations in terms of chunks and coordinates. As mentioned earlier, 3 gates are to other servers and 3 gates are within the same server and within a few hundred blocks of each other centered around 0,0,0.

Let me know if you have any thoughts on this behavior.

Cheers.

commented

After more testing and investigation this is actually a bug in Essentials. I hadn't actually removed that plugin whilst testing as I rely on some of its commands, but it was the culprit. I submitted a bug report and the developer confirmed it. Apologies for the noise. I am not sure what AncientGates is doing during the load phase which means it is scanning the world and those chunks etc, but hopefully load times improve.

EssentialsX/Essentials#3493

commented

I did notice the plugin started taking longer to load in 1.15 as well, however it used to take around 1 second and it jumped to around 5-10 seconds in my personal experience. If you're getting several minutes then something else must be wrong, my first guess would be hardware related like a really slow disk and/or CPU. But I'm interested to see if that Essentials issue also had any impact even though I don't see why it would.

Ever since I started maintaining this project I always avoided touching the original author's code, apart from updating between versions, since it was working (mostly)fine before. So, since I didn't write the code this would require quite a bit of debugging to see what's actually happening and, to be honest, I won't have time to do it for a few weeks.
Anyway, I'm going to leave this open, if you don't mind, because the increased loading time is definitely still an issue, even if exaggerated by Essentials as you discovered.

commented

Sorry about this issue -- was a mistake in hindsight, but the new Essentials release has a new /tprandom command which have a config option (which in 2.18.0.0 is default true, but as of 2.18.0.2 is now changed to false) that pre-caches several chunks to speed up command execution for the first few times it's run.

This was not a problem during development, on a Paper server & set world border, however when on Spigot and/or with a world border that is not set, it can cause a slow startup and several chunk loads extremely far from spawn. Again, this should not be an issue on newer builds as we have went to change the default to false, and requires no further action from server owners.

That's all. Just wanted to make sure the problem was clear here. Good luck in debugging your own loading time issues! ๐Ÿ˜‰

commented

Thank you for letting me know. I'm pretty sure the issue in this plugin also comes down to chunk loading, it became such a heavy task in the newest Minecraft versions but it can't really be avoided since the plugin needs to check the gate locations.
Still not sure how Essentials caused such an increase on this plugin's load time though, as far as I know, it only loads gate locations so even if there are random regions generated it should have zero effect.
Well, I'm sure I will figure it out when I debug it.

commented

Pre caching will cause the first tick to take longer on Spigot servers, so if you're using that as a metric it may have an impact. Although, loading times for the server itself should not be affected.

commented

I believe this issue is pretty much fixed now. It is at least faster than before but it will always depend on the server hardware and the amount of gates created.