PaperMC not terminating processes
SoladiemDev opened this issue · 2 comments
What I did / Steps to reproduce
We set up the plugin as normal, some chunks were preloaded using another plugin, but it's not a particularly massive world.
Expected result
We expected the plugin to run as intended, and not have a substantial impact on server performance.
Actual result
Our ram usage was maxed out, exceeding our 5012mb limit non-stop, and it caused the server's performance to suffer. It appears as if BlueMap's tasks were running non-stop, querying the server repeatedly:
The first dip is when several players logged off, the second is after a scheduled restart and during a time when nobody was online, and the 3rd dip is after uninstalling BlueMap.
Context
BlueMap 3.16, PaperMC 0C0A480 (MC 1.20.1)
So .. first of all, BlueMap is not using the ChunkTaskScheduler
that you have marked in your screenshots at all, and BlueMap is also not loading any net.minecraft.world.level.chunk.Chunk
s. BlueMap's rendering is based directly on the world-files, so all the classes from your screenshots are never even touched by BlueMap :)
Secondly, lets clear up some things on how Java's memory-management works:
Java is using its own internal RAM-pool (the "heap") to manage memory. This heap gets increased in size based on memory-usage and based on the GarbageCollector. It rarely gets decreased in size again, because that's usually just wasting resources.
So: the ram-usage you see from the outside is only the size of javas heap, and not the actual memory that java uses/needs.
BlueMap has to do lots of very fast calculations and data-processing while rendering. Which means very quick (short-living) memory-allocations in a short amount of time. This means that javas GarbageCollector (based on it's settings) decides to increase the heap: to have more time to efficiently manage this memory-allocations and collect (and discard) everything that's not needed anymore.
This is not a bad thing! It's just using all the memory it has to work as efficiently as possible :)
Our ram usage was maxed out, exceeding our 5012mb limit non-stop
You can and should use the -Xmx
-startup flag to limit the amount of RAM java is allowed to allocate to its heap. This should always be a bit less than there is available on your server. If java allocates more RAM than it should, then this always is a configuration-issue on your end. If there would not be enough RAM for your server to run, then you would get actual errors ^^
Fun fact:
BlueMap is tested to run fine with 12 render-threads (standalone, no minecraft server) on only 512MB of RAM.
I am pretty sure that your performance-issues are actually coming from something else, and are not BlueMap's fault. But if you still think they come from BlueMap, then you can try to reduce the render-thread-count
in bluemap's core.conf
. BlueMap will render more slowly and give your server and javas GarbageCollector more time to do other things :)
Here is some more info about performance tweaking.
If you have more questions about this, please feel free to visit our discord :)
Thank you so much for your response! I'm a big newbie when it comes to server stuff, so I outsourced my help to my partner who's helping me run it :P
I'll definitely look into those startup flags and try to poke a little deeper into how everything works. The lag did stop and memory usage has remained lower than it was since uninstalling, but I definitely will try and get it working again with your advice. Sorry for the trouble!!