simibubi / Above-and-Beyond

[Forge Modpack] Create's official Challenge-pack
140 stars 47 forks source link

Lag Spikes and ridiculously full memory for unapparent reason #270

Open cubeydoodoesitup opened 2 years ago

cubeydoodoesitup commented 2 years ago

Hosting a lan server using above and beyond 1.3. Not using anything besides the pack and cant seem to figure out why the memory is filling up 10gb ram right off load and lag spiking every second or so. Seems to be a cache or something not clearing maybe i dunno =[ any help would be greatly appreciated.

IdrisQe commented 2 years ago

could be your JVM settings- i wouldn't reccommend having 10GB allocated since it can mess with the garbage collection and cause bigger, more frequent lagspikes, on a LAN server 4-6GB should be more than enough for a few people, maybe even a bit overkill

i would also reccommend trying these JVM flags, they're the ones i personally use for the client and server and they seem to work really well for the most part, though the server does lag for a few minutes after startup/join as everything loads in

-Xmx6144M -Xms4096M -XX:+UseG1GC -Dsun.rmi.dgc.server.gcInterval=2147483646 -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=50 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=20 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=32M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -Dlog4j2.formatMsgNoLookups=true

cubeydoodoesitup commented 2 years ago

awsesome thanks trying that now

glektarssza commented 2 years ago

@cubeydoodoesitup Any success? If so please mark the issue as resolved.

pyrebuilder commented 2 years ago

Using these arguments, my occasional 30 second+ lag spikes are gone, instead I have 1-3 lags per minute lasting about 2-3 seconds each. I think there's a serious problem in the modpack somewhere that crops up specifically when a server has multiple players or enough chunks are loaded far enough apart.

pyrebuilder commented 2 years ago

I posted too soon! With these java arguments, eventually the lag spikes did get worse, up to a 50 second one that kicked all players.

glektarssza commented 2 years ago

I've seen a few posts on the CurseForge page that "Straw Golems Reborn" might be causing a (slow) memory leak. Can you try disabling that mod, @pyrebuilder, and report back? If it is causing issues it might be worth opening a separate ticket to cover that issue as without the original poster's feedback we can't confirm if that was their problem or not.

pyrebuilder commented 2 years ago

After an hour, it's so far running great @glektarssza but I want to wait until my third player (different base, more load, other mods he's focusing on) gets online before declaring success, I'll let you know the results!

pyrebuilder commented 2 years ago

So the other main player on my server got on, and the lag returned. LESS NOTICEABLE to be clear, but still undeniably present. So after he got off the lag stopped, which makes me think either: Something in his base/loaded chunks is the culprit, or The modpack is for some reason hanging up on asynchrinous users (One player at a higher ping threshold than the other)

He has used Occultism much more than us (His base is the only one with occultism wormholes and storage) and probably has made progress in other mods in the modpack we haven't. What would be a way for me to explore what might be the cause?

glektarssza commented 2 years ago

I'd suggest using one of the chunk loaders present in the mod pack (there's two; one from More Minecarts and one from ChunkNoGoByeBye) to load single chunks from his base to narrow down which chunk is causing the lag to manifest. If none of the chunks on their own cause it to happen then you can try loading pairs of chunks, triplets of chunks, etc. until you cause the lag again. Once you determine which chunks it is you can see what's different in those chunks. It probably won't tell you exactly what's causing it but it should narrow the list down significantly.

The alternative would be to start removing mods until the lag goes away. You'd need to back up your server save beforehand so you can restore it afterwards as I can't predict what will happen to any features of a given mod if you remove it.

pyrebuilder commented 2 years ago

So it appears that there were two issues: 1: Straw Golems mod 2: Quantum entangled singularities entering a wormhole and going into dimensional storage.

Once he stopped putting QE singularities into dimensional storage, the lag completely vanished!

glektarssza commented 2 years ago

Good to know! Probably should open a separate ticket for that. I doubt the mod pack author can do anything about it but best to track it somewhere.

pyrebuilder commented 2 years ago

There may be a third issue. So, the straw golem mod, once removed, reduced the overall lag that was accumulated over time, but the lag still got bad when he logged online. Once he removed the QES from the dimensional storage, the extreme lag spikes vanished, but the long term gradual memory leak was still present. This lag spike is only present while he's online, and he's the one using occultism still, though not with QES anymore. So I wonder if there's a memory leak in Occultism at the core of this whole problem, and the straw golem mod might not be the source of it after all. I'm guessing the way to troubleshoot this would be to make a backup, remove occultism, see if it fixes?

glektarssza commented 2 years ago

Yeah, that'd be the way to test that. It's entirely possible that Occultism has issues in the build included in the mod pack.