JVM garbage collection parameters for AEM 6.5 LTS on Java 17 and 21
This article explains the recommended JVM garbage collection parameters for Adobe Experience Manager (AEM) 6.5 LTS running on Java 17 or 21 and provides guidance for migrating from legacy CMS GC options.
Description description
Environment
- Adobe Experience Manager (AEM) 6.5 LTS
- Java 17 or Java 21
Symptoms
When upgrading AEM 6.5 LTS to run on Java 17 or Java 21, the previously used -XX:+UseConcMarkSweepGC (CMS GC) option from Java 8 is deprecated and unsupported. The default garbage collector for Java 17 and 21 is G1GC, and GC log output options have changed to the -Xlog:gc* format. Customers require updated, officially recommended JVM GC parameters and migration guidance.
Cause
Java 17 and 21 deprecate and remove support for CMS GC, requiring migration to G1GC and updated JVM parameters for compatibility and optimal performance with AEM 6.5 LTS.
Resolution resolution
Follow the steps below to resolve the issue:
-
Review the official Adobe documentation for Java 17/21 considerations for AEM 6.5 LTS.
-
Update your JVM parameters for AEM 6.5 LTS with Java 17/21. Sample parameters include:
-XX:+UseG1GC--add-opens=java.desktop/com.sun.imageio.plugins.jpeg=ALL-UNNAMED--add-opens=java.base/sun.net.www.protocol.jrt=ALL-UNNAMED--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED--add-opens=java.xml/com.sun.org.apache.xerces.internal.dom=ALL-UNNAMED--add-opens=java.base/java.lang=ALL-UNNAMED--add-opens=java.base/jdk.internal.loader=ALL-UNNAMED--add-opens=java.base/java.net=ALL-UNNAMED-Djdk.util.zip.disableZip64ExtraFieldValidation=true -
Consider additional G1GC tuning options:
Set G1GC thread counts (adjust according to available CPU resources):
-XX:ParallelGCThreads=2-XX:ConcGCThreads=2Adjust the heap occupancy threshold for initiating GC:
-XX:InitiatingHeapOccupancyPercent=70Limit the Metaspace size to avoid out-of-memory errors:
-XX:MaxMetaspaceSize=1024m -
Remove any legacy CMS GC options (such as
-XX:+UseConcMarkSweepGC) from your JVM startup parameters. -
Test the new G1GC configuration in a staging environment to validate performance and stability before deploying to production.
-
Monitor GC logs using the
-Xlog:gc*format and adjust parameters as needed for your workload.
Confirm that AEM starts and runs as expected with the updated JVM parameters.