Blog on [Java]

Icon

Configuring the G1GC Garbage Collector for AEM

Jayan Kandathil

First published

Last updated

In Java 9 and newer releases, the default garbage collector is "Garbage First" (G1) - see JEP 248. This collector divides the provisioned heap into 2048 to 4096 so-called "Regions" which are then tagged as "Eden", "Survivor" and "Tenured". Watch Kirk Pepperdine's March 2018 VoxxEd session and Sergey Kuksenko's Oracle [Code One] 2018 session for more details.

So far, the following configuration settings seem to make AEM work well (assumes an instance with 16 GB of memory, and 4 vCPUs) (see this for GC logging configuration):
-Xms8g -Xmx8g -XX:MaxMetaspaceSize=512m -XX:+UseG1GC -XX:+TieredCompilation -XX:MaxTenuringThreshold=15 -XX:+AlwaysPreTouch -XX:ParallelGCThreads=2 -XX:ConcGCThreads=2
To get a list of all available garbage collectors (including ones marked as experimental), run this command:
java -XX:+UnlockExperimentalVMOptions -XX:+PrintFlagsFinal | grep "Use.*GC "

See index for all entries in this blog.