If the memory size of each data node in your Alibaba Cloud Elasticsearch cluster of V6.7.0 or later is 32 GiB or larger, you can configure a garbage collector for the cluster. You can also change the garbage collector type for the cluster. CMS and G1 garbage collectors are supported. This topic describes how to configure a garbage collector.
Background information
By default, the CMS garbage collector is used for Alibaba Cloud Elasticsearch clusters. If the heap memory usage of a cluster reaches 75%, the CMS garbage collector triggers garbage collection. If the heap memory size of your cluster is large, we recommend that you switch the garbage collector for the cluster to the G1 garbage collector to improve garbage collection performance. For more information, see Garbage Collection Primer.
Prerequisites
An Alibaba Cloud Elasticsearch cluster is created. For more information, see Create an Alibaba Cloud Elasticsearch cluster. The cluster must meet the following requirements:
Version: V6.7.0 or later
Memory size of each data node: 32 GiB or larger
If the specifications of your cluster do not meet the preceding requirements, upgrade the cluster configuration. For more information, see Upgrade the configuration of a cluster.
Elasticsearch clusters that do not meet the preceding requirements can use only the CMS garbage collector. In addition, you cannot switch the garbage collector to the G1 garbage collector for the clusters.
Procedure
- Log on to the Alibaba Cloud Elasticsearch console.
- In the left-side navigation pane, click Elasticsearch Clusters.
- Navigate to the desired cluster.
- In the top navigation bar, select the resource group to which the cluster belongs and the region where the cluster resides.
- On the Elasticsearch Clusters page, find the cluster and click its ID.
In the left-side navigation pane of the page that appears, choose .
In the Basic Configuration section, click Modify on the right side of Garbage Collector.
You can modify the configuration of the garbage collector for a cluster only if the cluster meets the following requirements:
Version: V6.7.0 or later
Memory size of each data node: 32 GiB or larger
ImportantBefore you modify the configuration of the garbage collector for a cluster, you must make sure that the cluster is in a normal state. After you modify the configuration, the system restarts the cluster. The time required for the restart depends on the size, data volume, and load of the cluster. We recommend that you perform the operation during off-peak hours.
In most cases, if the indexes of your cluster have replica shards and the load of your cluster is normal, your cluster can still provide services during a cluster configuration change. The following items indicate that the load of a cluster is normal: The CPU utilization of each node in the cluster is about 60%, the heap memory usage of each node in the cluster is about 50%, and the value of NodeLoad_1m for each node is less than the number of vCPUs for the node.
If the indexes of your cluster do not have replica shards, the load of the cluster is excessively high, and large amounts of data are written to or queried in your cluster, access to the cluster may time out during a cluster configuration change. We recommend that you configure an access retry mechanism for your client before you perform a cluster configuration change. This reduces the impact on your business.
In the Modify Configuration panel, select G1 and click OK.
After you confirm the operation, the system restarts the cluster. After the cluster is restarted, the garbage collector is switched to G1.
References
API operation for switching the garbage collector for a cluster: UpdateAdvancedSetting