Legacy Knowledge Base
Published Sep. 10, 2025

Garbage Collection on Java 21

Written By

Apsara Raheja

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

NOTE: Liferay Support does not recommend or endorse specific third-party products over others. The information provided about products not created by Liferay is for reference purposes only, and any implementation of these principles will be at your team's discretion.

Issue

  • Need the JVM parameters that Liferay recommends for Quarterly Release with Java 21
  • The deployment checklist for tuning the Liferay DXP 7.4 contains only the instructions for tuning the JVM parameters for Java 8 and Java 11.

Environment

  • Liferay Quarterly Release
  • JDK 21

Resolution

  • Java Virtual Machine (JVM) tuning primarily focuses on adjusting Java heap and non-heap settings and configuring garbage collection.
  • The deployment checklist explicitly provides only a starting point for Liferay DXP deployment’s performance and a list of critical parameters for tuning. However, it'll vary based on the hardware and software specifications.
  • Here is the Liferay documentation: Tuning your JVM for learning purposes, and the user can add the additional GC settings on Java 21 (start testing with G1’s default settings) by following the article: https://docs.oracle.com/en/java/javase/21/gctuning/garbage-first-garbage-collector-tuning.html#GUID-90E30ACA-8040-432E-B3A0-1E0440AB556A
  • However, as specified in the deployment checklist, there are additional "new" algorithms like G1, but Liferay Engineering’s tests for G1 have indicated that it does not improve performance. The application performance may vary, and it should be added as per the testing and tuning plans
  • Additionally, G1 Garbage Collection logs can be collected using the following JVM configuration
    -verbose:gc -Xlog:gc:/tmp/liferaygc1.log

Additional Information

Did this article resolve your issue ?

Legacy Knowledge Base