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.
| Field | Description |
|---|---|
|
Initial heap size of the Hazelcast process as a percentage of the total memory of a container. |
|
Maximum heap size for a JVM running with a large amount of memory. |
|
Maximum heap size for a JVM running with a small amount of memory. |
Example configuration
The following Hazelcast custom resource creates a cluster that uses all three parameters.
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:
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
| Before making garbage collector-related changes using Operator, read Garbage collector considerations to decide which garbage collector to use. |
To set the garbage collector:
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 |
|---|---|
|
|
|
|
|
|
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:
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"