RonanPlugins / BetterRTP

Official wiki of the BetterRTP plugin!
https://www.spigotmc.org/resources/36081/
MIT License
111 stars 86 forks source link

BetterRTP is doing I/O operations on main thread #81

Closed Xemorr closed 2 years ago

Xemorr commented 3 years ago

image

BetterRTP is saving to files on the main thread, this has consequential effects on server performance. Here it is shown to be using 16% of main thread.

SuperRonanCraft commented 3 years ago

I wouldn't say this is any issue, as the plugin does not write to a file all the time, but I will put this on the todo list cause it could help with chunks loading slowly upon first teleporting. This might spawn database caching instead of the current file caching system to save player data.

Xemorr commented 3 years ago

It's quite bad when you're on a large server and accounts for lag spikes a lot.

Xemorr commented 3 years ago

image If you look here ^ it's almost a MB which makes the saving time not trivial

SuperRonanCraft commented 3 years ago

Ouch yeah, Ima have to move player data to a sqlite database, wont be easy, but its all asynchronous and low on memory when searching and I wont have to load the whole file at once. I will see if I can implement a way to transfer the data over automatically as well, cause some servers are large and most people dont read the patch notes

Xemorr commented 3 years ago

Yeah that's a good idea, thanks Ronan!

Xemorr commented 2 years ago

I decided to have a go at fixing it myself, or at least creating some sort of patch for my own use and I realised that you've also effectively created a memory leak as you're loading the entire file at boot rather than as players join, this means the more and more offline players a server accumulates, the more memory is used.

SuperRonanCraft commented 2 years ago

Ha, thank you, I was working on doing a complete rework, this will save me a good amount of time. The memory leak I was aware of, but I do see how it could be an issue on large servers, I will be replacing this with a SQL database VERY soon, just haven't had any time to sit down and program lately.

SuperRonanCraft commented 2 years ago

Alright, this has finally been fixed in a build I have been working on, I have moved all Cooldowns to save and load asynchronously. I will be releasing this build very soon after plenty of debugging ;)

SuperRonanCraft commented 2 years ago

Was able to completely debug and seems like everything is good to go, please let me know if you find any issues with the new cooldowns saving method ;)

Xemorr commented 2 years ago

Awesome, thank you Ronan!