legacy-knowledge-base
公開されました 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

learn-legacy-article-disclaimer-text

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