Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Overview

While profiling a FOLIO instance running Juniper release, we found out that it is using Mark and Sweep Garbage Collection phases but were not sure which Garbage Collection algorithm it was using. We created

Jira Legacy
serverSystem Jira
columnIdsissuekey,summary,issuetype,created,updated,duedate,assignee,reporter,priority,status,resolution
columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
serverId01505d01-b853-3c2e-90f1-ee9b165564fc
keyPERF-201
 - POC to investigate Garbage Collection in FOLIO modules

...

Use -Xlog:gc flag to enable logging when a module loads up. For example, we used mod-data-export to experiment. It was using openjdk-11. 

Experiments:

Both All experiments were carried out on openjdk-11.0

  1. Running mod-data-export locally on my laptop
java -jar -Xlog:gc=debug:file=gc.log target/mod-data-export-fat.jar

Image Modified

JVM automatically selected G1 Garbage Collector. G1 (Garbage First) Garbage Collector is designed for applications running on multi-processor machines with large memory space. 

...

       3. Explicitly select G1 Garbage Collector when loading mod-data-export using flag XX:+UseG1GC. Also, tried to override using -XX:+AlwaysActAsServerClassMachine flag. However, Data Export App in UI fails to poll the backend and crashes frequently.

...

       4. Tested in a cap planning environment that is running 8 Cores(m5.2xlarge EC2 instance type) but JVM is still using Serial Garbage Collection

...

For Java 9+ version, the default Garbage Collection is G1. So when running locally on my laptop, JVM automatically selected G1. However, there is a caveat that there must be enough CPU and memory resources in a multi-core OS. 

While EC2 instance with m5.xlarge instance type is running with default 2 CPU Cores. https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/cpu-options-supported-instances-values.html

...