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

Eyamaz

New Member
Jul 29, 2019
2,373
0
0
Thanks for the explanation!
I do know IT, but I do not know Java (parameters) so I had to try and guess which people on the interwebs had some good parameters. Unfortunately, there are no 'easy' sources of information I could find about these settings so I'm quite happy you explained them!

The only thing I do know is that my 'claim' still stands for my person, whether my used parameters are bogus or not.

hrm... I'll have to try to look through the source code of the JVM again to see if I can see if it actually changes anything with how the virtual machine runs itself. unfortunately i only have the openJDK to go off of and not oracles actual hotspot code, but i DID see a bit of improvement using SSE4 with u40 over u25 and couldn't see any with J6, so...

but I digress, its tentatively in the current set i'm using because I'm forcing bytecode rewrites to keep permgen and codecache low for users.
 

totte1015

New Member
Jul 29, 2019
391
0
1
What is Heap setting?

I set all to default and it said too small inital heap size

Instance started with command:
"C:\Program Files\Java\jre7\bin\java.exe" -Xmn512m -XX:TargetSurvivorRatio=80 -XX:MaxTenuringThreshold=31 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+DisableExplicitGC -XX:MaxGCPauseMillis=40 -XX:GCPauseIntervalMillis=150 -XX:+AggressiveOpts -XX:permSize=1024m -XX:+TieredCompilation -XX:ReservedCodeCacheSize=2048m -XX:+UseCodeCacheFlushing -XX:CompileThreshold=1000 -Xms512m -Xmx2048m -jar MultiMCLauncher.jar "totte1015" "0d5cc1419bc64cce903e5711fa38d689" "MultiMC: Unleashed" "854x480" "Mojang"

Error occurred during initialization of VM
Too small initial heap for new size specified
Minecraft exited with code 1.
Minecraft has crashed!
 

Eyamaz

New Member
Jul 29, 2019
2,373
0
0
inside the Settings --> java on multimc there are two boxes that say "Minimum Memory Allocation" and "Maximum Memory Allocation." Both should be set to 2048.
 

Eyamaz

New Member
Jul 29, 2019
2,373
0
0
I do not recommend using Early Access builds for general use since they lack security patches.
 

Viper-7

New Member
Jul 29, 2019
30
0
0
TieredCompilation is to improve _startup_ performance, it will actually *hurt* runtime performance, quite a bit in some cases. It's designed for services that have a very short lifetime (a minute or less) so they don't take forever to startup when they don't need aggressive runtime optimizations.

If you want to try an alternative set of options, check out this thread on the minecraft forums
http://www.minecraftforum.net/topic...d-line-options-for-minecraft-servers-clients/
We built that list up in the FTB IRC channel, based on several people doing independent research on all the options, then we checked our theories with real world testing with modded servers & clients.

We didn't spend any time optimizing the young generation heap size (-Xmn), since the point was for the average modern computer, which has way more RAM than needed, but where Minecraft still tends to run poorly :p


Edit: The link also includes a command line for Java 8, which i'm currently using. Reports have been mixed on the upgrade, some people report next to no change in performance, whereas others like myself have doubled their frame rate from both updating to Java 8 and using the tweaked command line arguments we derived.
 

TomeWyrm

New Member
Jul 29, 2019
898
1
1
Ok, that's... odd. The "-XX:+TieredCompilation" flag makes my client quit out almost immediately after FML launches wrapped Minecraft.

I get these lines:
[ForgeModLoader] Launching wrapped minecraft
[STDOUT] Inserted super call into axs.c
[STDOUT] awv was overriden from NotEnoughItems 1.6.1.4.jar
[Minecraft-Client] Setting user:(REDACTED)
[Minecraft-Client] (Session ID is token:REDACTED)
[SEVERE] [ForgeModLoader] Unable to launch

and then the launcher gives me this exception: http://pastebin.com/mfwL4ggx
 

Eyamaz

New Member
Jul 29, 2019
2,373
0
0
TieredCompilation is to improve _startup_ performance, it will actually *hurt* runtime performance, quite a bit in some cases. It's designed for services that have a very short lifetime (a minute or less) so they don't take forever to startup when they don't need aggressive runtime optimizations.

If you want to try an alternative set of options, check out this thread on the minecraft forums
http://www.minecraftforum.net/topic...d-line-options-for-minecraft-servers-clients/
We built that list up in the FTB IRC channel, based on several people doing independent research on all the options, then we checked our theories with real world testing with modded servers & clients.

We didn't spend any time optimizing the young generation heap size (-Xmn), since the point was for the average modern computer, which has way more RAM than needed, but where Minecraft still tends to run poorly :p


Edit: The link also includes a command line for Java 8, which i'm currently using. Reports have been mixed on the upgrade, some people report next to no change in performance, whereas others like myself have doubled their frame rate from both updating to Java 8 and using the tweaked command line arguments we derived.

i responded to these on the minecraft forums. except for your TieredCompilation statement.

TieredCompilation runs very similar to -server, which 64bit java versions from oracle default to anyway. the biggest difference is that TieredCompilation uses a little more CPU right from the start to quickly compile needed methods. When used in the proper setup it increases runtime performance by keeping high use methods from decompiling into interpreter mode when JIT passes through the codecache to check for methods to move into interpreter mode and then be removed from permgen. the only time this can become an issue is if the codecache is filled with useless methods that are better run in interpreted mode. that is what the -XX:+UseCodeCacheFlushing tag is there to prevent.

also I wont support Java8 till an official release because it doesn't have the necessary security patches for general public use. once installed, you open yourself to all sorts of malicious jscript that can do serious damage to your computer or your pocket book/identity.

Ok, that's... odd. The "-XX:+TieredCompilation" flag makes my client quit out almost immediately after FML launches wrapped Minecraft.

I get these lines:
[ForgeModLoader] Launching wrapped minecraft
[STDOUT] Inserted super call into axs.c
[STDOUT] awv was overriden from NotEnoughItems 1.6.1.4.jar
[Minecraft-Client] Setting user:(REDACTED)
[Minecraft-Client] (Session ID is token:REDACTED)
[SEVERE] [ForgeModLoader] Unable to launch

and then the launcher gives me this exception: http://pastebin.com/mfwL4ggx

OS
System Specs
Modpack, including a list of added/removed mods
java version
also, please post the entire log to pastebin and link. remove any IPs first though please.
 

Viper-7

New Member
Jul 29, 2019
30
0
0
TieredCompilation runs very similar to -server, which 64bit java versions from oracle default to anyway. the biggest difference is that TieredCompilation uses a little more CPU right from the start to quickly compile needed methods. When used in the proper setup it increases runtime performance by keeping high use methods from decompiling into interpreter mode when JIT passes through the codecache to check for methods to move into interpreter mode and then be removed from permgen. the only time this can become an issue is if the codecache is filled with useless methods that are better run in interpreted mode. that is what the -XX:+UseCodeCacheFlushing tag is there to prevent.


Normally the JVM runs entirely interpreted at first, profiling methods as it goes, then compiles the most frequently executed methods, using information from the profiler to optimize how it compiles each method.

TieredCompilation allows the JVM to use compiled instead of interpreted methods for the profiling stage and early runtime. This can massively improve startup times, but completely removes many of the advantages of the Hotspot VM's profiler. With TieredCompilation enabled your time until first tick should be lower, and the tick time of the first handful of ticks should be improved, but subsequent ticks, which could/should have taken advantage of optimizations from the profiler during their compilation stage, are now using unoptimized implementations.

+UseCodeCacheFlushing, otherwise known as Speculative flushing, will more aggressively clear the code cache, preemptively clearing methods that are probably still useful, to keep a specified amount of free space in the code cache, in anticipation of bursts of output from the compiler.
A valid argument might be to instead increase the initial and maximum code cache sizes, but unless these are being exhausted and the compiler disabled, that shouldn't change anything either way.

You seem to be conflating the permgen heap with the code cache. These are separate pools. If anything, the opposite of your argument is true. By using +UseCodeCacheFlushing, you are causing excessive destruction of perfectly useful compiled code, which then clutters permgen with now defunct meta-data entries until the next GC cycle.

Rest of your points refuted on the minecraft forums :p
 

TomeWyrm

New Member
Jul 29, 2019
898
1
1
Windows 7 Home Premium x64 (SP1)

Mods: Minecraft 1.6.2 + Forge 9.10.1.871 + Better Signs 1.6.2.C

Java x64 1.7.0_40

System Specs:
AMD Turion II M500
2 x 2GB Nanya PC2-6400 DDR2-800MHz (NT2GT64U8HD0BN-AD)
ATI Mobility Radeon HD 4500

Using the server flags (sans -jar “put your server jar name here” nogui) on the vanilla minecraft launcher

http://pastebin.com/YcL894mJ

===== Edit =====

It works perfectly fine without "-XX:+TieredCompilation" flag set.

As far as I can tell, without TieredCompilation my setup runs just fine, with a caveat: I haven't built this monstrosity out of pipes: http://i.imgur.com/tAPqmyd.png, nor have I built a 16x16x16 cube of furnaces, filled a chunk with XyCraft Tanks, or any other crazy stress tests. I also haven't been running it for days as I'm currently trying to keep my private 1.6.2 pack up-to-date and play the Refugee to Regent Challenge by Maul_Junior from here on the FTB Forums. Unfortunately my days have been spent bug-hunting, ID Future-proofing, and finding more mods that replace as much functionality from my core mods that I've lost in the 1.4.7 -> 1.5.x and 1.5.x -> 1.6.x transitions. Real life also gets in the way FAR too often.
 

Eyamaz

New Member
Jul 29, 2019
2,373
0
0
Ok, I thought you were using one of porshce's mods, just didn't know which one. I'll have a looksee, but he edits, I think 3 base class files with better signs? Idr, I'll test this when I get time tonight. I should've been asleep 2 hours ago, I have to be up in 4.
 

Eyamaz

New Member
Jul 29, 2019
2,373
0
0
Next iteration is being pushed back baring testing after talking with Viper and going over some more stuff on the OpenJDK site.
 

Omicron

New Member
Jul 29, 2019
2,974
0
0
It's great to see that you're teaming up. Aggregated knowledge can only help make things better!
 

Eyamaz

New Member
Jul 29, 2019
2,373
0
0
Viper pointed out something very important that didn't know about tiered comp so I had to root around on openjdk for the tiered comp .hpp listing and found the docs I was given by a friend were inaccurate as all hell. Now I have the right jvms to tweak tiredcomp and the formulas with it. I'm also using a section of his jvms tweaked to fit with what I'm doing.

So far I've had anywhere from 20% to 45% lower ram usage and a drop in overall cpu usage.

They are only running on one server atm, but the server owner has seen around a 50% drop in ram usage and a significant drop in cpu usage. TPS stays at 20 up to 9 or 10 users are online. After that TPS starts dropping from a large entity count (4000+) and fluxes with server max of 40 players, but the server stays stable (ish) and the players don't lag or notice as much apparently (i guess they noticed before he loaded up these jvms.)

More testing.
 
  • Like
Reactions: GuildMaster

Mtshaw113

New Member
Jul 29, 2019
36
0
0
Do I just put the Args in ServerStart.bat ? Im running Unleashed and for some reason its taking up 50% of my CPU, and it definitely should not be, so I started looking for some hopeful fixes. My server is a rack server my dad got from his work, 32GB of ram, Intel Xeon 4 quad cores at 3.4 GHz. I set the priority to High in Task Manager, but i dont know if that does anything(My dad is really smart and stuff and he said it should). So if anyone has anyone other solutions for me that'd be amazing.
 

keybounce

New Member
Jul 29, 2019
1,925
0
0
Hello. I just found out about this thread. I'm the guy responsible for those slightly out-of-date J6 memory settings recommended on the Mystcraft wiki for lower-end machines, as well as the guy tending to the minecraft forum version at http://www.minecraftforum.net/topic.../page__st__120__gopid__24958185#entry24958185 -- and yes, my focus is on lowering memory usage in smaller modpack setups.

I'll expand a bit more since I'm here (ish) now. There are basically two types of blocks in minecraft. SimpleBlocks and TileEntities.

...

In SSP, the client technically does all the work. Both client and server calculations are done in a single MC thread and slow it down. -- snip --

It's my understanding that minecraft now has two threads even in "single player" -- that the server thread, and the GUI thread, are now separate, and that this was the whole 1.3.2 update mess.

Based on that, the effect of tile entities in SSP should be similar to the effect in a client/server setup, _if you are running both on the same machine_!

If you have some spare cores, this basically doubles the performance (client and server both get their own core, more-or-less). If you have a low-end machine, then yes, the same machine has to do both server calculations, and rendering calculations, and tile entities will increase the sever calculations.

A bit of feedback concerning your argument selection.

I have a dedicated SMP server for the world and my client running on the same machine. I am using your arguments on both the client and the server (16 GB system memory ought to be more than enough for everything). During normal gameplay, the server sits at 1 GB memory and the client at 2 GB in the task manager process view.

... but I discovered that going through a nether portal a lot is memory leaky for whatever reason. -- snip --

You aren't the only one to find nether portals _USUALLY_ leaky.

Nether portals,
Disconnecting/reconnecting to servers
Closing and reloading single player saves

All of these cost memory.

I don't know why the leak is there. I've even tried forcing the "soft reference" cleanup parameter down to zero (there is a documented bug that it can cause memory leaks and out-of-memory issues when it works perfectly as designed.) But yes, it does mean having to restart the client occasionally.

There are a few arguments that I want to add to the recommendations in this thread, if you are at all serious about tracking memory usage and needs:

-XX:+PrintGCDateStamps \
-XX:+PrintHeapAtGC -XX:+PrintTenuringDistribution \
-XX:+PrintCommandLineFlags -XX:+PrintGCDetails -Xloggc:GC.log \

Optional:
-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=9 -XX:GCLogFileSize=10M \

What these do: Log your system's use of memory to a file. The "optionals" are recommended if you have a long-lived server, and are not needed for the client.

What the key data will look like:

Code:
Heap after GC invocations=1426 (full 23):
par new generation  total 53248K, used 1409K [0000000007010000, 000000000be10000, 000000000be10000)
  eden space 26624K,  0% used [0000000007010000, 0000000007010000, 0000000008a10000)
  from space 26624K,  5% used [0000000008a10000, 0000000008b707c8, 000000000a410000)
  to  space 26624K,  0% used [000000000a410000, 000000000a410000, 000000000be10000)
concurrent mark-sweep generation total 123940K, used 79686K [000000000be10000, 0000000013719000, 0000000021e10000)
concurrent-mark-sweep perm gen total 41312K, used 32568K [0000000021e10000, 0000000024668000, 000000002b410000)
}

Note that in this case, the server is using tenured space of just under 80MB, out of about 123MB allocated (it was reset after yesterday's session, so this is just idle sitting there waiting for the first player since restarting). Also note that the code space is 32 MB used out of 41 MB allocated -- I use a much, MUCH smaller modpack than FTB.

But if you want to know how much space to allocate, you have to be able to track the actual usage, and you have to log the data to tell what you are actually using.

Client side, I see very different numbers -- here is from something running under magic launcher last night:

Code:
2013-10-13T00:00:03.539-0700: 723.479: [GC 723.479: [ParNew
Desired survivor size 28311552 bytes, new threshold 8 (max 8)
- age  1:    193488 bytes,    193488 total
- age  2:    416616 bytes,    610104 total
- age  3:    953168 bytes,    1563272 total
- age  4:    142680 bytes,    1705952 total
- age  5:    102096 bytes,    1808048 total
- age  6:      59456 bytes,    1867504 total
- age  7:      85616 bytes,    1953120 total
- age  8:      33024 bytes,    1986144 total
: 45041K->2356K(92160K), 0.0091470 secs] 290388K->247729K(378880K), 0.0092098 secs] [Times: user=0.02 sys=0.01, real=0.01 secs]
Heap after GC invocations=300 (full 9):
par new generation  total 92160K, used 2356K [7e1e00000, 7e9600000, 7e9600000)
  eden space 61440K,  0% used [7e1e00000, 7e1e00000, 7e5a00000)
  from space 30720K,  7% used [7e7800000, 7e7a4d078, 7e9600000)
  to  space 30720K,  0% used [7e5a00000, 7e5a00000, 7e7800000)
concurrent mark-sweep generation total 286720K, used 245373K [7e9600000, 7fae00000, 7fae00000)
concurrent-mark-sweep perm gen total 83968K, used 71189K [7fae00000, 800000000, 800000000)
}
2013-10-13T00:00:03.549-0700: 723.488: [GC [1 CMS-initial-mark: 245373K(286720K)] 247729K(378880K), 0.0017413 secs] [Times: user=0.00 sys=0.00, real=0.01 secs]
2013-10-13T00:00:03.551-0700: 723.490: [CMS-concurrent-mark-start]
2013-10-13T00:00:03.675-0700: 723.614: [CMS-concurrent-mark: 0.123/0.124 secs] [Times: user=0.26 sys=0.00, real=0.12 secs]
2013-10-13T00:00:03.675-0700: 723.614: [CMS-concurrent-preclean-start]
2013-10-13T00:00:03.676-0700: 723.616: [CMS-concurrent-preclean: 0.001/0.001 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
2013-10-13T00:00:03.676-0700: 723.616: [GC[YG occupancy: 2625 K (92160 K)]723.616: [Rescan (parallel) , 0.0009740 secs]723.617: [weak refs processing, 0.0002759 secs]723.617: [class unloading, 0.0106787 secs]723.628: [scrub symbol & string tables, 0.0060800 secs] [1 CMS-remark: 245373K(286720K)] 247999K(378880K), 0.0209779 secs] [Times: user=0.02 sys=0.00, real=0.02 secs]
2013-10-13T00:00:03.697-0700: 723.637: [CMS-concurrent-sweep-start]
2013-10-13T00:00:03.786-0700: 723.726: [CMS-concurrent-sweep: 0.089/0.089 secs] [Times: user=0.09 sys=0.01, real=0.09 secs]
2013-10-13T00:00:03.786-0700: 723.726: [CMS-concurrent-reset-start]
2013-10-13T00:00:03.787-0700: 723.727: [CMS-concurrent-reset: 0.001/0.001 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
Heap
par new generation  total 92160K, used 4506K [7e1e00000, 7e9600000, 7e9600000)
  eden space 61440K,  3% used [7e1e00000, 7e2019910, 7e5a00000)
  from space 30720K,  7% used [7e7800000, 7e7a4d078, 7e9600000)
  to  space 30720K,  0% used [7e5a00000, 7e5a00000, 7e7800000)
concurrent mark-sweep generation total 286720K, used 163029K [7e9600000, 7fae00000, 7fae00000)
concurrent-mark-sweep perm gen total 83968K, used 70860K [7fae00000, 800000000, 800000000)

That's a lot of information. It starts with a dump of "how much memory is used by temporary data of a given age" -- that's controlled by the XX:MaxTenuringThreshold option. It then reports that 245 MB of long-term data (aka "tenured") data is stored. It then does a full CMS collection, and after that, only 160 MB of long-term data is used -- so about 80 MB of junk was sitting around. (It also happens to be when I shut down -- that final report is the "end of program" memory dump). Note that the client has a lot more code in the perm gen.

While Evamaz is correct in pointing out that permspace (for code) and heap space (for data) are separate, it's also important to keep track of Tenured, Eden, and Survivor -- especially when using CMS. You absolutely do not want survivor overflows to be common. Too much space in Tenured is just a waste. Putting more space in Eden reduces the rate of minor collections, letting more temporary stuff die off and not be tenured, reducing the need to do major collections -- but costing more system resources at the same time.

Permanent Generation – This contains non-compiled classes/methods
CodeCache – This contains compiled classes/methods

I use J6 (not 7), and have not seen any reference to CodeCache in the docs I can find. As far as I can tell, J6 puts even compiled code into the permgen.

Apple did/does maintain java 6 for the macs; primarily, they have this arrangement (As far as I can tell from official docs/press releases) so that Java apps can have a Macintosh look-and-feel, instead of a "partially Microsoft windows look-and-feel" (and no, java programs on Microsoft windows do not behave like native programs on Microsoft windows -- close, but not the same.) Java 7, however, is straight Oracle code, not given any Apple alterations.

Last time I checked, Macintosh's, Minecraft, and Java 7 was a broken combination.

I'm a week late, but thought I'd mention that Oracle does indeed support OSX for java 7, I currently am using 7u40 on OSX 10.8.5 with minecraft

10.7.5 here. Waiting for 10.9 to get the kinks worked out. Glad to know that this issue is resolved in the future.

-XX:SoftRefLRUPolicyMSPerMB=2048 once again. this is a TIME in MILLISECONDS and is set to TWICE the default value (1000) which will actually slow down your server once it gets "busy" THIS SHOULD STAY AT 1000.

CAUTION! If this value is non-zero you can get a memory leak.
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6912889
Documents how, when this parameter works as described, memory leaks and is not collected.

Your comments on tiered compilation are interesting. I'd love to see those docs and your current test recommendations.
 

Freestone101

New Member
Jul 29, 2019
10
0
0
When I use your server start script the cmd opens on my pc and the instantly closes. How do I fix this?

Windows 7 Home Premium 64 bit
8GB of Memory
Java x64 1.7.0_40tMindCrack 8.3.2 + Optifine
Intel i5-2400
 

Ashzification

New Member
Jul 29, 2019
7,425
1
0
When I use your server start script the cmd opens on my pc and the instantly closes. How do I fix this?

Windows 7 Home Premium 64 bit
8GB of Memory
Java x64 1.7.0_40tMindCrack 8.3.2 + Optifine
Intel i5-2400

Not on this thread.
Open a tech support thread. This is not a generic "ooh please help me with my problem" thread. It's an information thread.