Skip to main content
Version: latest-snapshot

Configure JVM arameters

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

Configure a JVM parameter​

Operator supports the following JVM configuration options in the Hazelcast resource. For more information, see the API reference.

FieldDescription
initialRAMPercentageInitial heap size of the Hazelcast process as a percentage of the total memory of a container.
maxRAMPercentageMaximum heap size for a JVM running with a large amount of memory.
minRAMPercentageMaximum heap size for a JVM running with a small amount of memory.

Set arbitrary JVM arguments​

You can provide a list of JVM arguments.

Example configuration
yaml
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
yaml
apiVersion: hazelcast.com/v1alpha1
kind: Hazelcast
metadata:
name: hazelcast
spec:
jvm:
memory:
initialRAMPercentage: "10"
maxRAMPercentage: "20"
minRAMPercentage: "10"

Garbage collector parameters​

Enable logging​

To enable garbage collector logging, you can use the following configuration:

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

This sets the JVM argument -verbose:gc.

Set the garbage collector​

warning

Before making garbage collector-related changes using Operator, read Garbage collector considerations to decide which garbage collector to use.

To set the garbage collector:

Example configuration
yaml
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

Enable IPv6 stack​

You can use JVM arguments to enable IPv6 addressing in Hazelcast and set up a Hazelcast cluster on an IPv6-stack Kubernetes Cluster. The following example creates an IPv6 Hazelcast cluster:

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