Migrating to Java G1GC garbage collection

Reading up on G1GC in forum posts, I've gathered:

Clients

  1. Add jvm-args="-XX:+UseG1GC" to the end of the target string in the native client launcher shortcuts to use G1GC under Java 7 (from this post by @pturmel). On the other hand, I'm thinking this is not required as long as clients are running on Java 8+. See next point.
  2. Consider limiting Java versions to 8+ in gateway settings as G1GC is the default in Java 8 per this post by @pturmell. Also note G1GC is not fully supported prior to JDK7 release 4.

Are there any other requirements/gotchas for the client end of things?

Gateway
From this post by @kathyapplebaum, it looks like starting with Ignition 7.9.8, G1GC is the default for Java 8+. That's great! However, it appears upgrading to 7.9.8 doesn't do the trick; an installation commissioned last year with an earlier version and then upgraded to 7.9.8 still shows CMS garbage collection in ignition.conf despite the fact ignition.conf on this machine is as installed (not edited):

# Java Additional Parameters
wrapper.java.additional.1=-XX:PermSize=64m
wrapper.java.additional.2=-XX:MaxPermSize=128m
wrapper.java.additional.3=-XX:+UseConcMarkSweepGC
wrapper.java.additional.4=-XX:+CMSClassUnloadingEnabled
#wrapper.java.additional.5=-XX:+CMSPermGenSweepingEnabled
wrapper.java.additional.6=-Ddata.dir=data
wrapper.java.additional.7=-Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false
#wrapper.java.additional.8=-Xdebug
#wrapper.java.additional.9=-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000

# Initial Java Heap Size (in MB)
wrapper.java.initmemory=256

# Maximum Java Heap Size (in MB)
wrapper.java.maxmemory=1024

Based on this post by @pturmel, I'm thinking we'd edit our ignition.conf file shown above something like this to enable G1GC running on Java 7:

# Java Additional Parameters
wrapper.java.additional.1=-XX:+UseG1GC
wrapper.java.additional.2=-XX:MaxGCPauseMillis=100
wrapper.java.additional.3=-Ddata.dir=data
wrapper.java.additional.4=-Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false

# Initial Java Heap Size (in MB)
wrapper.java.initmemory=256

# Maximum Java Heap Size (in MB)
wrapper.java.maxmemory=1024

Coming back to quote below, it seems we shouldn't need the UseG1GC option if gateway is running on Java 8 as G1GC is the default in Java 8:

So ignition.conf could be reduced to the below for gateways running on Java 8:

# Java Additional Parameters
wrapper.java.additional.1=-XX:MaxGCPauseMillis=100
wrapper.java.additional.2=-Ddata.dir=data
wrapper.java.additional.3=-Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false

# Initial Java Heap Size (in MB)
wrapper.java.initmemory=256

# Maximum Java Heap Size (in MB)
wrapper.java.maxmemory=1024

Is the above on the right track? Anything else to consider/do to make the change to G1GC?

1 Like

Oracle backed out of its announced rollout of G1GC as the default in Java 8. It supposedly is the default finally in Java 9, but I haven’t switch to 9 yet. Adding the switches won’t hurt anything if its the default.

1 Like

Also, ignition.conf is part of a gateway backup. A restore into v7.9.8 will replace it with the backed-up version.

3 Likes

Thanks for the clarifications, @pturmel. Sounds like using -XX:+UseG1GC switch in ignition.conf and adding it to client launcher targets is still the way to go.

We haven’t restored a backup onto this one since upgrading to Ignition 7.9.8, but thanks for the reminder that we’ll want to take a fresh backup after modifying ignition.conf. It is possible the ignition.conf file restored onto this server prior to upgrade to Ignition 7.9.8 was modified at some point in the distant past, so perhaps upgrading to 7.9.8 with an unmodified ignition.conf would have automatically switched to G1GC.

With ignition.conf edited (as in the “for Java 7” example in my first post above), server is now using G1GC. Gateway web interface shows “Garbage Collectors: G1 Young Generation, G1 Old Generation” on performance page and all appears to be well. Thanks!

1 Like