elBukkit / PreciousStones

Self-service protection for Minecraft servers
http://dev.bukkit.org/server-mods/preciousstones/
10 stars 10 forks source link

Lag 1.16.1 #57

Closed Marcuri02 closed 3 years ago

Marcuri02 commented 3 years ago

Hello, I write here because I'm having sooo lag on my server and the boys of the Discord of PaperMC tell me:

This are my timings: https://timings.aikar.co/?id=65d0298f72e04e0b840e72d154f38800

Thanks.

xtomyserrax commented 3 years ago

Hey, why do they say its PreciousStones? Could be, im not the author so Im not 100% familiar with what this plugin does. But your timings doenst show any big issue, or at least I cant see it

Marcuri02 commented 3 years ago

I think it is. With version 1.3 it’s going fine, but 1.4 lags. Where I can talk with the author and report that?

xtomyserrax commented 3 years ago

Version 1.4 didnt have any changes that could make lag, just bug fixes, so it should also be with older versions...

The author left the plugin ages ago, Nathan and me are helping to fix issues with it. So well, in those timings I cant see the problem with PS, and all the updates I made didnt add content so it is not possible that the latest one is causing lag but the one before doesnt

A248 commented 3 years ago

The problem it seems is that PreciousStones is using player.teleport. However, this method forces the destination chunks to be loaded immediately and thus synchronously, voiding the opportunity to take advantage of multithreaded chunk loading.

This can be solved by using PaperLib and refactoring player.teleport calls to use PaperLib.teleportAsync and running the following logic inside the callback.

A248 commented 3 years ago

Here is how it is known that PreciousStones is triggering sync chunk loads.

Screenshot 2020-07-21 at 6 26 01 PM

xtomyserrax commented 3 years ago

Got you, thanks a lot for the additional information @A248 , it was really helpful!

I will label this as an enhancement rather than a bug because as A248 told, this seems more than a spigot issue (which is our main API) rather than a plugin one (maybe Im wrong)

If anyone wants to make a PR to add this enhancement feel free, the main objective is to also keep compability with spigot so it must work with both. When I have time, Ill have a look into how to add this (as I have never added any custom paper stuff into a plugin)

xtomyserrax commented 3 years ago

Lag issues solved thanks to @A248