Closed Periodic 3 second lag spikes

C

CDArena

Guest
Summary of the problem Periodic 3 second lag spikes

Pack Version 1.2.1

What is the bug? Periodically FTB Beyond will "freeze" for 2-3 seconds; it happens during many different activities, and in different places in the world. (Walking around in existing chunks, placing a torch, even standing in place and swiveling around). I have saved & exited right afterwards and checked the "latest.log" file - every time I see something like "16:57:38] [Client thread/INFO]: Default sorting." It happens above ground and down near bedrock - I cant seem to isolate any particular circumstance or actions responsible. I had the same issue in version 1.1.0 and upgrading to 1.2.1 did not help.

Mod & Version FTB Beyond, version 1.2.1

Link to log file

Is it repeatable? For me = yes. I just start Curse launcher, and open up my FTB Beyond game. Usually within 5-8 minutes I start seeing these lag spikes.

Known Fix Nothing I can figure out gets rid of the lag spikes permanently (increasing memory to 6GB, etc). If I play long enough without exiting completely out of the launcher, eventually the lag spikes happen every 10 seconds or so. Also, TaskMan doesn't show anything unusual during the spikes, and background tasks don't hiccup so it seems to just be FTB Beyond.
 
C

CDArena

Guest
That is what I thought at first, because restarting the game helps, and restarting the Curse launcher helps. With a fresh restart of everything, I was able to play for about 40 minutes without noticing anything other than the normal tiny "hiccups" when traveling in one direction and loading chunks. About 40 minutes in, I had my first big spike (freezes for about 3 seconds - but the log just says server cannot keep up). A few minutes later, my FPS on the surface dropped from the normal 90-120 down to 64-70 - but the game is still very playable and "smooth". 60 minutes in I had another big 3 second "freeze" (log this time shows the sorting entry). Then about 6 minutes later I had my third 3 second freeze. This is all in my latest log which I will post in a few minutes.

In the past two days I've noticed similar behavior - and one time it was so noticeable that I just stood in place and used the mouse to spin around and around - every 10 seconds or so I would freeze for 3 seconds. The log file that day showed a crap ton of "Default sorting"/"Sorting completed"/"Can't keep up" entries 10 seconds apart.

I have noticed that this usually happens in conjunction with a world save, but why spinning in place would make that happen repeatedly, I cannot fathom.
 
C

CDArena

Guest
Latest log from my test run: http://paste.feed-the-beast.com/view/a2498185
I am still early game in this world - a generator, 2 EIO machines for ore processing, and a 3x3x3 smeltery; 7 double chests, and no other dimensions visited. I have explored a small area around my spawn, but the world save folder is only 37MB at this point.

I will explore the java arguments to see if they help and post updates. (I usually just use the Curse launcher and override the standard memory settings up to 6GB)


EDIT: Trying the following args
-XX:+UseG1GC -Xmx6G -Xms6G -Dsun.rmi.dgc.server.gcInterval=2147483646 -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M -Dminecraft.applet.TargetDirectory="C:\Users\CDArena\Documents\Curse\Minecraft\Instances\FTB Beyond" -Dfml.ignorePatchDiscrepancies=true -Dfml.ignoreInvalidMinecraftCertificates=true -Duser.language=en -Duser.country=US
 
Last edited:
C

CDArena

Guest
Well - with new java settings I had a 3 second spike about 7 minutes in, but then lasted about an hour to the next bad spike - but it the mean time the game seemed a lot more "jerky" and not as smooth. If I had to guess I would say that GC is occurring more frequently but in shorter intervals, thus the "jerkiness". The 3 second spikes still seem to be related to world saves, so if that is the case then a RAM disk with backups to physical disk might be a work around for me.
 

Henry Link

Popular Member
Dec 23, 2012
2,601
553
128
USA - East Coast
So are you playing single player? Because one of the things I read above was about "Server Can't Keep Up" messages. That is an indication that you are maxing out one of your cores on the processor. If it is single player have you considered breaking out the server into its own core away from client?
 

thunderbolt_6

New Member
Jul 29, 2019
43
0
0
that type of garbage collection its not the best (-XX:+UseG1GC) use instead -XX:+UseConcMarkSweepGC , its the best in latency
And yes, i do a LOT of research of the garbage collection ¬¬
 
C

CDArena

Guest
I am in single player - not sure how to tell Minecraft to separate the server and client on processors though (i5 CPU) . AV should not be an issue - TaskMan shows it isn't consuming any CPU time during these spikes, and most other mod packs don't spike like this.

I'll give those two jvm args a try again - most of the other packs I play don't have these lag spikes as long as I give them enough RAM.
 

thunderbolt_6

New Member
Jul 29, 2019
43
0
0
I am in single player - not sure how to tell Minecraft to separate the server and client on processors though (i5 CPU) . AV should not be an issue - TaskMan shows it isn't consuming any CPU time during these spikes, and most other mod packs don't spike like this.

I'll give those two jvm args a try again - most of the other packs I play don't have these lag spikes as long as I give them enough RAM.
that is not the full argument for GC, and dont put xmx and xms with the same GB, let minecraft consume what it need

Code:
-Xms512M -Xmn768m -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+UseNUMA -XX:+CMSParallelRemarkEnabled -XX:MaxTenuringThreshold=15 -XX:MaxGCPauseMillis=30 -XX:GCPauseIntervalMillis=150 -XX:+UseAdaptiveGCBoundary -XX:-UseGCOverheadLimit -XX:+UseBiasedLocking -XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=90 -XX:MaxTenuringThreshold=15 -Dfml.ignorePatchDiscrepancies=true -Dfml.ignoreInvalidMinecraftCertificates=true -XX:+UseFastAccessorMethods -XX:+UseCompressedOops -XX:+OptimizeStringConcat -XX:+AggressiveOpts -XX:ReservedCodeCacheSize=2048m -XX:+UseCodeCacheFlushing -XX:SoftRefLRUPolicyMSPerMB=10000

in this put you cores of your processor
Code:
-XX:ParallelGCThreads=K
the K means ->12,8,6,4,2 etc
 
Last edited:

BrickVoid

Well-Known Member
Dec 2, 2012
593
57
54
that is not the full argument for GC, and dont put xmx and xms with the same GB, let minecraft consume what it need

-Xms512M -Xmn768m -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+UseNUMA -XX:+CMSParallelRemarkEnabled -XX:MaxTenuringThreshold=15 -XX:MaxGCPauseMillis=30 -XX:GCPauseIntervalMillis=150 -XX:+UseAdaptiveGCBoundary -XX:-UseGCOverheadLimit -XX:+UseBiasedLocking -XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=90 -XX:MaxTenuringThreshold=15 -Dfml.ignorePatchDiscrepancies=true -Dfml.ignoreInvalidMinecraftCertificates=true -XX:+UseFastAccessorMethods -XX:+UseCompressedOops -XX:+OptimizeStringConcat -XX:+AggressiveOpts -XX:ReservedCodeCacheSize=2048m -XX:+UseCodeCacheFlushing -XX:SoftRefLRUPolicyMSPerMB=10000

in this put you cores of your processor - X X : P a r a l l e l G C T h r e a d s=12,8,6,4,2 etc (needed to put spaces to avoid emoticons :( )

You don't need to put spaces in, just use the code tags in the editor, it's located under the "Insert..." icon. You should be able to edit your post to reflect this.

Example of args above in code tags (not the one you spaced out):

Code:
-Xms512M -Xmn768m -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+UseNUMA -XX:+CMSParallelRemarkEnabled -XX:MaxTenuringThreshold=15 -XX:MaxGCPauseMillis=30 -XX:GCPauseIntervalMillis=150 -XX:+UseAdaptiveGCBoundary -XX:-UseGCOverheadLimit -XX:+UseBiasedLocking -XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=90 -XX:MaxTenuringThreshold=15 -Dfml.ignorePatchDiscrepancies=true -Dfml.ignoreInvalidMinecraftCertificates=true -XX:+UseFastAccessorMethods -XX:+UseCompressedOops -XX:+OptimizeStringConcat -XX:+AggressiveOpts -XX:ReservedCodeCacheSize=2048m -XX:+UseCodeCacheFlushing -XX:SoftRefLRUPolicyMSPerMB=10000

It might not word wrap properly, which means it appears with a horizontal scrollbar for very long args lines but for copying and pasting it works just fine as the args won't need extra indenting spaces or special word wrap characters that this forum editor would otherwise insert in it.

Cheers ...

BrickVoid
 
C

CDArena

Guest
Yes, I am familiar with Java argument syntax in general, just not what some of them do. For the past few days I have just stuck with the standard profile arguments but upping the memory to 6GB. I can live with restarting Curse & FTB Beyond after a few hours when it gets annoying. I was watching a Youtuber named Xogue who started FTB Beyond and you can see what happens in his very first video - the game just freezes and you can here him talk about it. (I was glad yet sad that it was not just me - It looks like there might be some room for improvement here with either the Curse Launcher or the FTB Beyond default configs settings.)

I'll give the latest args from Thunderbolt a try and see if they work any better for me
 
C

CDArena

Guest
Trying the following args:
Code:
-Xms512M -Xmn768m -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+UseNUMA -XX:+CMSParallelRemarkEnabled -XX:MaxTenuringThreshold=15 -XX:MaxGCPauseMillis=30 -XX:GCPauseIntervalMillis=150 -XX:+UseAdaptiveGCBoundary -XX:-UseGCOverheadLimit -XX:+UseBiasedLocking -XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=90 -XX:MaxTenuringThreshold=15 -Dfml.ignorePatchDiscrepancies=true -Dfml.ignoreInvalidMinecraftCertificates=true -XX:+UseFastAccessorMethods -XX:+UseCompressedOops -XX:+OptimizeStringConcat -XX:+AggressiveOpts -XX:ReservedCodeCacheSize=2048m -XX:+UseCodeCacheFlushing -XX:SoftRefLRUPolicyMSPerMB=10000 -XX:ParallelGCThreads=4
One question - I am not sure how java determines the maximum amount of memory it can consume - If I want to allow it to use up to 6GB, can I just add -Xmx6g to the above arguments? (In some of the other packs that have memory or startup issues with, I have had great success by just allowing it a start & max value of 6GB - perhaps not the optimal way to do it, but it has worked for me in the past)
 

thunderbolt_6

New Member
Jul 29, 2019
43
0
0
Trying the following args:
Code:
-Xms512M -Xmn768m -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+UseNUMA -XX:+CMSParallelRemarkEnabled -XX:MaxTenuringThreshold=15 -XX:MaxGCPauseMillis=30 -XX:GCPauseIntervalMillis=150 -XX:+UseAdaptiveGCBoundary -XX:-UseGCOverheadLimit -XX:+UseBiasedLocking -XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=90 -XX:MaxTenuringThreshold=15 -Dfml.ignorePatchDiscrepancies=true -Dfml.ignoreInvalidMinecraftCertificates=true -XX:+UseFastAccessorMethods -XX:+UseCompressedOops -XX:+OptimizeStringConcat -XX:+AggressiveOpts -XX:ReservedCodeCacheSize=2048m -XX:+UseCodeCacheFlushing -XX:SoftRefLRUPolicyMSPerMB=10000 -XX:ParallelGCThreads=4
One question - I am not sure how java determines the maximum amount of memory it can consume - If I want to allow it to use up to 6GB, can I just add -Xmx6g to the above arguments? (In some of the other packs that have memory or startup issues with, I have had great success by just allowing it a start & max value of 6GB - perhaps not the optimal way to do it, but it has worked for me in the past)
yes you can add that, cuz i using curse app i dont need to add that :) thats the current arg of my ftb beyond and infinity pack arg.
good luck with the lag ;)
 
C

CDArena

Guest
So far so good - thanks for those settings; I did notice a few spikes lasting for much shorter time, but nothing like the "jump off a tree and freeze in mid air for 3 seconds until GC is completed then resume falling" type of spike I was seeing before.
 
C

CDArena

Guest
As a side note, I do still get the 3 second lag spikes even with the new settings - but not quite as often as before, so perhaps the settings do help. Youtubers out there: just be prepared to edit at times.
 
L

limbaughnomicon

Guest
I ran across this thread due to experiencing practically the same issue and looking for a fix - am going to try some of the recommendations in the thread but also wanted to post the version information, etc I'm having in case anyone else has experienced it.

FTB Beyond version 1.5.3
I never noticed this behavior in early version of the pack, though to be honest I never put a whole lot of time into it at once (probably under 45 minutes a session).
Today however updated to 1.5.3 and have been playing about 2-3 hours, started noticing 2-3 seconds of lag every so often, becoming more frequent the longer in game.
Checking Task Manager during these occurrences i see CPU spike every time it happens, avg. CPU is about 25% but when this occurs it is hitting 95-100% just for the period of time I experience the lag spike in game.
Seems to happen regardless of what I am doing in game, e.g. I could be mining or just walking in a straight line and it will occur.
I have 4 GB allocated to the profile (using Twitch [formerly Curse] launcher), and memory usage on my system is about 75% avg.
16 GB RAM total in my system with i7-2600K CPU, Nvidia GTX 1070, Minecraft is running on Samsung SSD.

I play quite a few modpacks and haven't noticed this behavior before (Sky Factory 3, Project Ozone 2, Direwolf20 1.10).