Have a Question?
Print

JVM GC Arguments, Java 11 vs Java 8

 

JVM arguments used to control GC logging changed between Java 8 and Java 11.  Java 8 does not recognize the new Java 11 arguments and will not start when the Java 11 arguments are used.  Java 11 has depreciated the Java 8 style GC arguments and some are no longer supported.  Java 11 ignores some of the Java 8 GC arguments but not all.  BASIS recommends updating the GC arguments BBjServices uses when upgrading from Java 8 to Java 11.

 

The BASIS installer (since BBj 20.10) strips the following JVM arguments from BBjServices:

 

-XX:+PrintGCDetails

-Xloggc:<BBjHome>/log/BBjServices_gc.log

-verbose:gc

 

The java 11 GC arguments the installer replaces them with is

 

-Xlog:gc*:file=<BBjHome>/log/BBjServices_gc.log:tags,uptime,level:filecount=10,filesize=25m

-XX:+UseStringDeduplication

 

There are a lot of other args that customers may have added that may or may not need to be removed.  Here are some examples

 

-Xmx6000m

-Xms6000m

-XX:NewRatio=3

-XX:+UseParNewGC

 

BASIS recommends keeping the -Xmx and -Xms.  If removed, the Java 11 JVM uses 1/4 of physical memory for the max heap size (-Xmx) and 1/64 of physical memory for the initial heap size (-Xms) by default.

 

The defaultThe -XX:NewRatio=3 hinders G1GC and should be removed.  Any NewSize settings should be removed when using G1GC (the default GC for Java 11).

 

The default GC used by Java 11 is G1GC whereas Java 8 used the Parallel collector.  BASIS recommends using the default collector.  In the example arguments above BASIS recommends removing -XX:+UseParNewGC.

 

Any NewSize/NewRatio settings can hinder G1GC.  BASIS recommends removing -XX:NewRatio=X, -XX:NewSize=XXX and -XX:MaxNewSize=XXX.

 

 

How to Turn Off BBjServices’ GC Log File Rotation

When running BBj with Java 11 before BBj 20.10, there is a GC log rotation conflict.

a) Java 11 rotates the GC log files by default.

b) The /<BBjHome>/bin/bbjservices script rotates the GC log files upon every restart by default.

Having both the JVM and BBjServices rotate the GC logs causes issues with the GC logs.  When running with BBj prior to 20.10 with Java 11 it is recommended to turn off the GC log rotation done by BBjServices.

Non Windows:

BBj 19.10 to 20.01

Starting in BBj 19.10, you can add “doRotateGCLog=0” to the “Custom Definitions” section in the /<BBjHome>/bin/bbjservices script which will be preserved during upgrades.  Here is the Custom Definitions section of the script that has to be updated with the line doRotateGCLog=0:

 

# Default setting is to rotate the log files

doRotateOutLog=1

doRotateErrLog=1

doRotateGCLog=1

 

#———- Start Custom Definitions (DO NOT REMOVE THIS LINE) ———-

doRotateGCLog=0

#———- End Custom Definitions (DO NOT REMOVE THIS LINE) ———-

Prior to BBj 19.10

On versions prior to BBj 19.10 you can turn off the rotation by commenting out the “rotateGClog” call in the /<BBjHome>/bin/bbjservices script.  After commenting the line out the section of the script looks this:

 

# Time to rotate bbjservices.out and bbjservices.err

#

rotateLog bbjservices.err

rotateLog bbjservices.out

#rotateGClog

Note: For version prior to BBj19.10 this change needs to be made after each BBj upgrade.  Since this change is not in the “Customer Definitions” section it is overwritten by the install each time a new version of BBj is installed.

Windows:

Please see JVM GC Arguments, Java 11 vs Java 8 above.  Replacing the “-Xloggc:…” argument for BBjServices with “-Xlog:gc…” turns off BBjServices GC logging on windows.

 

Table of Contents
Scroll to Top