optimize OnJoin event please?
jordanwilliams1 opened this issue ยท 3 comments
I've recently been doing some testing because I had a few plugins causing my server to freeze during players joining my server. I Noticed that essentials can freeze the server up to 0.20s upon joining, Maybe higher... I've got 2 images below. One with a server running with essentials and one without.
Could you please optimize the join event?
Without Essentials:
https://i.gyazo.com/bdf877a13e247315c3a5910b7553f40b.png
With Essentials:
https://i.gyazo.com/878df11683e75486837e37367f0a9cf1.png
(Main Jar)
The answer is: not really, no.
The only thing EssentialsX does in response to the join event itself is disable the vanilla join message if needed. The loading process happens in an asynchronous task outside the join event handler, and involves reading the userdata from disk. This isn't something we can easily change to magically speed up the join process.
I Guess it's the loading data that cause the freeze? I Downloaded vEssentials and that doesn't seem to cause any join lag. I Really hope that this will get optimized in the feature to not cause any join freeze.
In its current state, this can't easily be improved. EssentialsX's internal user mechanism relies on user data loading as soon as possible, as otherwise random parts of the plugin just won't work properly. This delay needs to happen somewhere, and since mail is checked on join this will have to happen during the join event.
You also provided absolutely no information about your testing environment. I personally haven't witnessed these freezes, and I'm not in a position to benchmark this myself, especially when the issue may not even be related to EssentialsX.
If you feel you have a solution that can improve EssentialsX's user data load times, feel free to contribute a PR. If you can provide details of your exact testing environment, including Java version, server version, plugin version, system specs and OS, it would assist in testing this.
If you're not willing to do either of these things, we can't provide any support.