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

Enabling IPv6 Stack

Hazelcast supports IPv6 addresses seamlessly, although IPv6 support is switched off by default. To enable IPv6 addressing in Hazelcast and set up a Hazelcast cluster on an IPv6-stack Kubernetes Cluster, you’ll need extra configurations. These configurations can be passed through JVM arguments. The provided example below shows how to create an IPv6 Hazelcast cluster using the Hazelcast Platform Operator.

IPv6 Example configuration
apiVersion: hazelcast.com/v1alpha1
kind: Hazelcast
metadata:
  name: hazelcast-ipv6
spec:
  jvm:
    args:
      - "-Djava.net.preferIPv4Stack=false"
      - "-Djava.net.preferIPv6Addresses=true"
      - "-Dhazelcast.prefer.ipv4.stack=false"