Tuning JVM Garbage Collection
When using OpenJDK 11* or OpenJDK 17*, Cloudera Manager and most Cloudera Runtime services use G1GC as the default method of garbage collection. (Java 8 used "ConcurrentMarkSweep" (CMS) for garbage collection.) When using G1GC, the pauses for garbage collection are shorter, so components will usually be more responsive, but they are more sensitive to overcommitted memory usage. You should monitor memory usage to determine whether memory is overcommitted.
- Log in to the Cloudera Manager Admin Console
- Go to .
- Look for entries labeled Memory Overcommit Validation Threshold and note the hostname of the affected host.
- Go to and click on the affected host.
- Click the Resources tab.
- Scroll down to the Memory section.
A list of roles instances and their memory allocations are displayed. The Description column displays the configuration property name where the memory allocation can be set.
- To adjust the memory allocation, search for the configuration property and adjust the value to reduce the overcommitment of memory. You may need to move some roles to other hosts if there is not sufficient memory for the roles running on the host.
- After making any changes, Cloudera Manager will indicate that the service has a stale configuration and prompt you to restart the service.
You may also need to adjust the Java options used to start Java processes. You can add Java startup options using Cloudera Manager configuration properties that are available for all service roles. Cloudera has provided default arguments for some of the services where they are needed. You can add to these, or completely override all of the provided Java options. For more information on configuring G1GC. see The OpenJDK documentation.
If default options are provided, the role configuration specifies a
single value, {{JAVA_GC_ARGS}}
. This value is a
placeholder for the default Java Garbage Collection options provided with
Cloudera Manager and Cloudera Runtime.
- Log in to the Cloudera Manager Admin Console.
- Go to the service where you want to modify the options. (For the Cloudera Manager Service Monitor, select the Cloudera Management Service.)
- Select the Configuration tab.
- Enter "Java" in the search box.
- Locate the Java Configuration Options property named for the role you want to modify. For example, in the HDFS service, you will see parameters like Java Configuration Options for DataNode and Java Configuration Options for JournalNode.
- To add to the Java options, enter additional options before or after
the
{{JAVA_GC_ARGS}}
placeholder, separated by spaces. For example:{{JAVA_GC_ARGS}} -XX:MaxPermSize=512M
- To replace the default Java options, delete the
{{JAVA_GC_ARGS}}
placeholder and replace it with one or more Java options, separated by spaces. - The service will now have a stale configuration and must be restarted. See Restarting a service.
Service and Role | Default Java 8 Options | Default Java 11 Options |
---|---|---|
|
To enable G1GC:
|
|
|
|
|
|
|
None, G1GC is enabled by default. |
|
|
None, G1GC is enabled by default. |
|
|
|
|
|
None, G1GC is enabled by default. |
|
|
None, G1GC is enabled by default. |
|
|
|