dmulloy2 / ProtocolLib

Provides read and write access to the Minecraft protocol with Bukkit.
GNU General Public License v2.0
982 stars 259 forks source link

Lag spike on player join #3011

Open Adaf5589 opened 2 weeks ago

Adaf5589 commented 2 weeks ago

There is a very momentary lag spike when a player joins. It is more significant when it is a new player. According to my timings report, seems like ProtocolLib is causing a lot of issues. Could be a culprit.

Here is the screenshot: timings

Not 100% sure if Protocol is the culprit, but sure looks like its taking up a major process.

HMJosh commented 2 weeks ago

I'd say its more likely that its a plugin utilizing Protocollib. Ran it on a server that had 20-30 players join at once and had no issue. Read more into the stack traces.

dmulloy2 commented 1 week ago

The way I'd recommend thinking about how ProtocolLib works is that it's sort of like how Bukkit allows plugins to listen for and fire events, but for packets. The Bukkit event handler code shows up as a big hog on the timings but in reality it's just enabling a plugin's functionality. Your likely culprit is another plugin that uses PL to send packets when a player joins

Adaf5589 commented 1 week ago

Yeah its so odd. I tried diagnosing with every plugin but I can't find the source of the issue. I have a sneaking suspicion it is Premium Vanish, since on default timings report (not spark) it says PremiumVanish is responsible for "loginevent" or something. I'm not very versed with packets etc.

I assume I contact the plugin developer directly. Is there anything on Protollib end to do/optimize?

Ingrim4 commented 1 day ago

Could you please provide the link to the spark report instead of a screen screenshot that might make it possible to find the culprit.

Adaf5589 commented 1 day ago

Sure, sorry ab that. https://spark.lucko.me/WSxl1VgRfY