Changing the JVM garbage collector type
You can change the JVM garbage collector type by using a CLI tool or by editing the Java properties file manually.
Before you begin
Before attempting to change the JVM garbage collector type:
|
If you proceed, ensure that you have a backup copy of your java.properties
file in the config
directory. The backup file usually has the same file name with a .old
extension. If you don’t have a backup, do one of the following:
-
Run
bin/dsjavaproperties --initialize
.Each time you run this command, the server overwrites the java.properties.old
file if it exists. It can also overwrite any changes you made tojava.properties
after installing the server. -
Copy the file to a safe directory manually.
About this task
The server supports the following garbage collection types:
Name | Encoded name | Supported JDK version(s) |
---|---|---|
G1 |
|
11, 17, 21 |
ZGC |
|
17, 21 |
Generational ZGC |
|
21 |
CMS |
|
8, 11 |
Steps
-
Change the garbage collector type by doing one of the following.
These choices involve running
$ bin/dsjavaproperties --initialize
, which can overwrite any changes you made tojava.properties
after installing the server.Choose from:
-
When making changes to multiple servers, use the
dsjavaproperties
tool.-
Run the following command, substituting the encoded name of the garbage collector from the previous table:
$ bin/dsjavaproperties --gcType <encoded_gc_name> --initialize
-
-
When making changes to one server, edit the
java.properties
file manually.-
Change the value of the
gc-type
parameter to the encoded name of the garbage collector from the previous table. -
Save the
java.properties
file. -
Run
$ bin/dsjavaproperties --initialize
.
-
-
-
Restart the server.
Troubleshooting
If something goes wrong and you need to restore your java.properties
file to the backup version, do the following:
-
Add a
.bad
extension to the malfunctioningjava.properties
file. -
Change the name of the working backup file to
java.properties
and, if needed, place it in theconfig
directory. -
Run
$ bin/dsjavaproperties
with no arguments. -
Restart the server.