A newer version of Hazelcast Operator is available.

View latest

Configuring JVM Parameters

You can configure the JVM in the hazelcast container using the jvm field of the CRD spec.

Configuring a JVM Parameter

Use any of the following configuration options in the Hazelcast resource. For more information, see the API Reference.

Field Description

initialRAMPercentage

Configures the initial heap size of the Hazelcast process as a percentage of the total memory of a container.

maxRAMPercentage

Sets the maximum heap size for a JVM running with a large amount of memory.

minRAMPercentage

Unlike its name, this parameter sets the maximum heap size for a JVM running with a small amount of memory.

Setting Arbitrary JVM Arguments

You can provide a list of JVM arguments.

Example configuration
apiVersion: hazelcast.com/v1alpha1
kind: Hazelcast
metadata:
  name: hazelcast
spec:
  jvm:
    args:
      - "-XX:MaxGCPauseMillis=200"

Example Configuration

The following Hazelcast custom resource creates a cluster that uses all three parameters.

Example configuration
apiVersion: hazelcast.com/v1alpha1
kind: Hazelcast
metadata:
  name: hazelcast
spec:
  jvm:
    memory:
      initialRAMPercentage: "10"
      maxRAMPercentage: "20"
      minRAMPercentage: "10"

GC Parameters

Enabling Logging

To enable Garbage Collector Logging, you can use the following configuration:

Example configuration
apiVersion: hazelcast.com/v1alpha1
kind: Hazelcast
metadata:
  name: hazelcast
spec:
  jvm:
    gc:
      logging: enabled

It is going to set the following JVM argument: -verbose:gc

Setting the Garbage Collector

Before making Garbage Collector related changes using the Hazelcast Platform Operator, it is highly recommended to read Garbage Collector Considerations section of Capacity Planning Document to decide which Garbage Collector to use.

To set the Garbage Collector, following configuration can be used:

Example configuration
apiVersion: hazelcast.com/v1alpha1
kind: Hazelcast
metadata:
  name: hazelcast
spec:
  jvm:
    gc:
      collector: <collector>

<collector> can be replaced with the following options:

<collector> JVM Equivalent

Serial

-XX:+UseSerialGC

Parallel

-XX:+UseParallelGC

G1

-XX:+UseG1GC