JVM Arguments for Modded Minecraft (Updated 12/30/13)

  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

keybounce

New Member
Jul 29, 2019
1,925
0
0
New world? Probably chunk generation.

If you are running into this issue in areas where you are generating new chunks, I've found that both COG and UB are pains in 164 when they were very nice and happy in 152.

If you are not generating new chunks, then it's a little less clear.

Does it happen both when you are a single player game, and when you connect to an SMP server on the local machine? An SMP server won't pause the tick speed for client rendering issues, so if it happens in one and not the other, that's something to look for. (If it happens in single player only, it may be rendering; if it happens in SMP only, it's in the tick handling side.)

Beyond that, something that causes tick spikes sometimes in mods, but not vanilla? Very possibly the garbage collection. Try adding -XX:+UseConcMarkSweepGC and see if there are any improvements. But really, without some baselevel comparisons, that's not of much use unless "it just works" -- for that, you need to read logs.
-XX:+PrintGCDateStamps -XX:+PrintHeapAtGC -XX:+PrintTenuringDistribution -XX:+PrintGCDetails -Xloggc:GC.log

That gives the garbage collection details, with time stamp; this lets you read the logs, look for garbage collection operations that take a long time, and see if those match up with your "This is laggy now" observations.

Yes, it can be a pain, but it's the only way I know of to determine if it is a garbage collection issue. Eyamaz has far more information and experience adjusting compiler settings than I do.
 
  • Like
Reactions: Eyamaz

Eyamaz

New Member
Jul 29, 2019
2,373
0
0
If you want to get into mod specifics, you're going to need something like jprofiler8 so you can identify the individual methods that are taking up the most resources. This, however, is exremelty intensive and will slow the speed of the game down considerably.

Using just visualvm you can monitor memory usage and allocation as well as gc cycles.

The two biggest forms if lag from java that can be adjusted is from data tenuring through the different heap spaces [eden > survivor > tenured] and "stop the world" garbage collection.
The next largest piece of "lag" that isn't really lag is from interpreted methods. When a class is interpreted it runs about 9.5 times slower than a class compiled into the C2 compiler. On much faster computers, you may not even feel the difference, but on lower end machines it can kill your performance. (i use a heavily modified tieredcompilation to alleviate this at the offset that it does cause stuttering for the first 5 to 10 minutes.)

If you're profiling a mod in a pack, visualvm is not the choice, jprofiler is. If you're profiling a mod outside of a pack, then visualvm is a good choice.
 

Someguy

New Member
Jul 29, 2019
121
0
1
My thanks to you both, I'll be trying all your suggestions as soon as I have some time.

Earlier today, before your posts came in, I had a chance to tinker with it a bit, and in frustration, I resorted to the unscientific and unsatisfying trial-and-error method of removing and reinstalling mods one at a time. I *think* I may have found one in particular that causes this but I can't be sure. It also seems quite an unlikely candidate... it's QuarryPlus, and I don't have so much as a pipe or anything beyond a vanilla furnace built... let alone quarries.

Anyway I'll test further and report back.
 

Mummified41

New Member
Jul 29, 2019
5
0
0
Eyamaz, Thanks for the research and time that went into this. Although I haven't gotten this to work yet, I'm sure it will be worth my while. Here is my problem:

My Rig:

OS: Mac OS X v10.8.5
Processor: 2.8GHz Intel Core i7
Memory: 16 GB
GFX: Nvidia GeForce GT 650M; 1024MB
Java: 7 Update 45 for OS X v10.8 or higher (using runtime parameters: -Xmx3072m -Xms3072)

To start the FTB launcher I use applescript:

tell application "Terminal"

do script "cd ~/Desktop/ftb/;export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home;java -jar FTB_Launcher.jar"

end tell


The following is what I have for my JVM arguments; I don't run anything other than single player survivor mode typically:

-Xms2048m -Xmx2048m -XX:PermSize=256m -XX:ReservedCodeCacheSize=512m -XX:NewRatio=4 -XX:SurvivorRatio=3 -XX:TargetSurvivorRatio=80 -XX:MaxTenuringThreshold=8 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=0 -XX:MaxGCPauseMillis=20 -XX:GCPauseIntervalMillis=250 -XX:MaxGCMinorPauseMillis=7 -XX:+CMSClassUnloadingEnabled -XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=50 -XX:+BindGCTaskThreadsToCPUs -XX:+TieredCompilation -XX:Tier0ProfilingStartPercentage=0 -XX:Tier3InvocationThreshold=3 -XX:Tier3MinInvocationThreshold=2 -XX:Tier3CompileThreshold=2 -XX:Tier3BackEdgeThreshold=10 -XX:Tier4InvocationThreshold=4 -XX:Tier4MinInvocationThreshold=3 -XX:Tier4CompileThreshold=2 -XX:Tier4BackEdgeThreshold=8 -XX:TieredCompileTaskTimeout=5000 -XX:Tier3DelayOn=50 -XX:Tier3DelayOff=25 -XX:+UseFastEmptyMethods -XX:-DontCompileHugeMethods -XX:+AlwaysCompileLoopMethods -XX:+CICompilerCountPerCPU -XX:+UseStringCache -XX:+UseNUMA

My console is telling me that it is setting my MinMemory to 256; max to 2048 and my "initial heap is too small." As I understand it from in your "for the curious" spoiler; the xms/xmx arguments are what determine the max and minimum heaps. Things I have tried: **Note neither did the MinMemory or the initial heap value change at all.

1. Changing xms/xmx to 3072m
2. Changing PermSize to 512m, 1024m

Any additional help would be greatly appreciated.

V/r,

Mummified41`
 
Last edited:

Eyamaz

New Member
Jul 29, 2019
2,373
0
0
Hrm, I'm not a mac guy but have been told there are still issues with macs and the v1 ftb launcher. You can try multimc4 and importing the ftb pack. Go to the settings -> java tab and copy the Server arguments EXCEPT Xms/xmx into the java parameters section then set both min and max mem to 2048.
If that doesn't work, maybe @keybounce can help. He's a mac guy.
 

Mummified41

New Member
Jul 29, 2019
5
0
0
Well, I got it to work but that doesn't mean it's working with the arguments. Here's what I did:

1. Went into the Java Console, placed the arguments in the java runtime environment settings except for xms/xmx
2. Opened the FTB Launcher
3. Went to the FTB options->adv options menu and set xms/xmx parameters
4. Launched FTB *It worked, but still said "min memory set to 256" of course I don't know if this is supposed to change.

In game:
FPS is always above or greater than 130
Allocated memory: 1203MB
Used memory of 2031MB: rises at a constant rate (don't know if anything can be done about this)

I'll have to delete the settings and try as it was since I don't have a base to go off of.

EDIT:
w/o putting any sort of arguments I get:
FPS >=153
Allocated memory: 1248MB
Used of 3055MB: still rises at a constant rate ~1% every 30-45secs
Moving between dimensions was relatively the same for both settings
 
Last edited:

Eyamaz

New Member
Jul 29, 2019
2,373
0
0
Failfish. i remember why i didnt add an option for the v1 ftb launcher, it expressly passes an Xms256m to the command line that overrides the Xms2048m from my arguments. i would say use mutlimc4 for now until a build of multimc5 is out for macs.
 

Gilliam

New Member
Jul 29, 2019
117
0
0
Mummified. Sorry to ask but how do you get oracle java 7 to run minecraft/ftb. I'm still operating apples java 6 as when I updated through oracle I couldn't load the game ?
Ps sorry. Also run mac os
 

keybounce

New Member
Jul 29, 2019
1,925
0
0
You are on a mac?

>Java: 7 Update 45 for OS X v10.8 or higher (using runtime parameters: -Xincgc-Xmx-3072m)
I'm on 10.7.5. From what I understand (and certainly true on 10.7.5), the J7 "JRE" only properly supports web apps; for command line programs you need the "SDK". Yea, that's a pain, blame Oracle. (They got it to work right on windows and linux).


Client, or single player? Or do you even get to the point of loading a world?

Oh, hold on:

> 1. Went into the Java Console, placed the arguments in the java runtime environment settings except for xms/xmx

If you are referring to what I think you are referring to, that is for J7 applets from the web browsers, NOT for command line applications.

Arguments for the client program need to either be in the advanced flags of the launcher, or (much easier in 1.5 and earlier) in a shell script that calls java -cp ... with a ton of arguments.

EDIT: I just noticed what you wrote here: "-Xincgc-Xmx-3072m". Be sure that there are spaces between the args.
 

Mummified41

New Member
Jul 29, 2019
5
0
0
@Eyamaz Well that would explain a lot XD. Thanks for the insight and help though. I'll try out multimc4 to see how it goes.

@Gilliam it's not technically oracle, it's JavaVM (virtual machine) I suppose I should edit my Java version since I'm not using oracle at all. Anyway, to get FTB to run on your mac you should be able to follow the directions here. Then read the post by Zurandis in that same thread.

@keybounce so does that mean that when I use applescript to use JavaVM to run ftb launcher I can input those arguments into that? so for instance:

tell application "Terminal"

do script "cd ~/Desktop/ftb/;export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home;java -jar FTB_Launcher.jar -Xms2048m -Xmx2048m etc."

end tell

Pretty sure there would have to be some other code that goes in there but even if that worked it wouldn't really help me out since FTB 1.0 forces 256...
 
Last edited:

Eyamaz

New Member
Jul 29, 2019
2,373
0
0
I know telling AppleScript to run the launcher with the arguments won't help. Minecraft starts in a new VM and passes new arguments to that VM.
 

Mummified41

New Member
Jul 29, 2019
5
0
0
I know telling AppleScript to run the launcher with the arguments won't help. Minecraft starts in a new VM and passes new arguments to that VM.

Yeah, hence why I said in the end it doesn't help me. I just thought it would be cool to set the arguments in the beginning and not have to mess with settings in the launcher. I'd use it for other things.

@keybounce In regard to your edit: yeah, I took another look at what I put. I don't even know how that ended up in there. It was supposed to be: -Xmx3072m -Xms3072m I don't even know what the other arguments are...
 
Last edited:

keybounce

New Member
Jul 29, 2019
1,925
0
0
@keybounce so does that mean that when I use applescript to use JavaVM to run ftb launcher I can input those arguments into that? so for instance:

tell application "Terminal"

do script "cd ~/Desktop/ftb/;export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home;java -jar FTB_Launcher.jar -Xincgc-Xmx-3072m -Xms2048 -Xmx2048 etc."

end tell

Pretty sure there would have to be some other code that goes in there but even if that worked it wouldn't really help me out since FTB 1.0 forces 256...

The "-jar FTB_Launcher.jar" would be at the end of the list of java arguments -- anything after that is options to the launcher.jar, not to java. So put the rest in front of that.

With that said, those arguments would change how the launcher is run, which is not the same as how the minecraft program is run. For that, you need to use the launcher's advanced arguments.
 

Eyamaz

New Member
Jul 29, 2019
2,373
0
0
I've never used atlauncher, so I don't know if they pass any arguments to the VM themselves so I can't make any recommendations. Same with technic launcher. It's not that I don't like them, I just don't use them.
 

reddvilzz

New Member
Jul 29, 2019
376
0
1
I've never used atlauncher, so I don't know if they pass any arguments to the VM themselves so I can't make any recommendations. Same with technic launcher. It's not that I don't like them, I just don't use them.

oh okay, maybe i'll try both MC and FTB arguments and see which one helps
 

Eyamaz

New Member
Jul 29, 2019
2,373
0
0
For 32bit, you would need to drop Xms/Xmx both to 1024m, PermSize to 128m, and ReservedCodeCache to 256m. I can not guarantee they will work correctly since I have everything geared toward a minimum of 2GB on the heap. Many modpacks just don't function well with less.
 
  • Like
Reactions: Hammerson

keybounce

New Member
Jul 29, 2019
1,925
0
0
In general, these are arguments that go into the advanced options section of your launcher config.

For 32 bit systems, the size of Xmx/Xms depends on your system. Macs, for example, can go up to 2000m; Linux varies, and some people can get 2500m. I've heard from some users of Microsoft Windows that 1500m works. (there is probably variation based on xp, vista, 7, or 8)

I'm pretty sure that the ATLauncher has a place to specify flags for java; which set you use depends on if you are using a client, or single player, or LAN. (A lot of us forget about LAN hosting; it's the most demanding form of running minecraft.)