Closed itsdinkd closed 2 years ago
What's the specific performance issue are you talking about? What actually is happening in game (freezing, or just lag, etc.)?
The spark log you gives me which expands out to the myLoot replacer is a red herring. If you see below when you expand it out, all it's doing is "waiting" calling LockSupport.parkNanos(). myLoot has to replace loot containers with the myLoot variant, but for that, it requires calling World.setBlockState() which waits until the chunk that the loot container is in is done being generated. If the server thread is spending all its time waiting there, that means that specific chunk is taking that long to generate/load.
If your game is freezing and crashes, and that's when you got that spark log, then it means something has caused that chunk to never be able to load (which I've seen happened with the Unstructured mod).
If your game is lagging and then eventually unfreezes itself, then it's just taking a long time for that chunk to load (which is also probably due to some other mod).
One thing I could try to do is time out the loot container replacement so it only spends some configurable maxTime before giving up on replacing a chest - but this means this isn't fixing the actual problem which is that chunk either not being able to load or taking a very long time and myLoot doesn't modify any chunk loading.
The spark log you gave only shows the Server Thread. Chunk loading is done on a separate thread, so if you have the full spark log showing all other threads, maybe we can dig into what is causing chunk loading to freeze/lag
This was taken from our server with multiple people in it, MSPT was getting hit / low tps.
The Link I sent is the full log that sparks generates, I don't really have anything other than that to offer in terms of spark as that is all they give.
Without the full thread dump, no one can tell what is causing chunk loading to take so long. myLoot isn't doing anything active, it's simply sleeping on the server thread, waiting for the chunk to be loaded.
I can try to look into some sort of timeout handling and not hold the server thread waiting for the chunk to be loaded, but it can cause weird issues like a player might see the regular chest and then it suddenly turns into a myLoot container - which is why I didn't want to do this initially. I'd have to try stuff out and test this
The root issue is not due to myLoot however, as some other mod or minecraft itself is taking a long time to load one of the chunks.
What command are you running spark with? There is a --thread *
argument that will make spark track all threads, not just the ServerThread: https://spark.lucko.me/docs/Command-Usage. You could try running that and it might output all the threads. One of them should be a thread that's loading chunks and then you might see why it's taking >11 seconds to load a single chunk
im using /spark profiler, no arguments.
I'll try what you suggested trying to get all the threads.
Please stand by. Waiting for another hit to occur
https://spark.lucko.me/HqcVgNPocm https://spark.lucko.me/79CREIrQ7X (ran this one longer)
I don't see myLoot in either of those spark logs. Do you still have myLoot installed on the server? If so, then it's a bit more proof of what I said above that myLoot isn't the root cause of your lag spikes because myLoot only hangs the server thread when it needs to replace loot containers -> which only happens if a chunk being loaded includes loot containers -> which needs to wait for chunk loading to finish.
The chunk loading thread is normally on the Worker-Main threads, but usually there should be quite a few of them - your spark logs only show 1. I'm not sure why that is, maybe some other mod put chunk loading on another thread?
In any case, the main server thread looks like it's taking up most of the time on ticking entities (see screenshot below). One more thing I noticed is there are a ton of threads running during your spark profiling. If your CPU doesn't have that many cores, having so many threads up on a single machine may degrade performance due to context switching - especially since it looks like most of these threads just wait and do nothing else.
@itsdinkd
I tried looking into this a bit more. I wonder if this change I made would help any bit. If you want, you could try the newer version I just uploaded (2.1.1-1.18): https://www.curseforge.com/minecraft/mc-mods/myloot/files/3838376
Honestly i havent seen much performance issues lately from MyLootr
if its a server side change only, I can put it in the official servers though, if it requires on client, that will be more difficult
@itsdinkd That's good, as I mentioned before, that probably means whichever mod that was causing chunkloading to slow down isn't doing it anymore or hasn't happened.
The update is server-side only, but if your server is working fine now, keep it that way :)
I'll close this issue for now. Feel free to reopen if issue comes back
@itsdinkd I found out how to fix the issue in the latest version! Do update when you can as it should greatly help improve server TPS - at least when myLoot was in play
Thank you, updating now :)
https://spark.lucko.me/JLF1MDTfyn