Skip to main content

Pod JVM trigger gc

Pod JVM trigger gc triggers the garbage collector for a Java process executing in a Kubernetes pod. This causes unused (or out of scope) objects and variables to be garbage collected and recycled, thereby freeing up memory space.

tip

JVM chaos faults use the Byteman utility to inject chaos faults into the JVM.

Pod JVM trigger gc

Use cases

Pod JVM trigger gc:

  • Determines how the application behaves when memory space is freed up randomly for a brief period.
  • Determines how efficiently an application recovers and returns to normalcy.

Optional tunables

Tunable Description Notes
TOTAL_CHAOS_DURATION Duration through which chaos is injected into the target resource. Should be provided in [numeric-hours]h[numeric-minutes]m[numeric-seconds]s format. Default: 30s. Examples: 1m25s, 1h3m2s, 1h3s. For more information, go to duration of the chaos.
POD_AFFECTED_PERC Percentage of total pods to target. Provide numeric values. Default: 0 (corresponds to 1 replica). For more information, go to pods affected percentage
JAVA_HOME Path to the Java installation directory. For example, /tmp/dir/jdk.
BYTEMAN_PORT Port used by the Byteman agent. Default: 9091.
CONTAINER_RUNTIME Container runtime interface for the cluster Default: containerd. Support values: docker, containerd and crio. For more information, go to container runtime.
SOCKET_PATH Path of the containerd or crio or docker socket file. Default: /run/containerd/containerd.sock. For more information, go to socket path.
RAMP_TIME Period to wait before and after injecting chaos. Should be provided in [numeric-hours]h[numeric-minutes]m[numeric-seconds]s format. Default: 0s. Examples: 1m25s, 1h3m2s, 1h3s. For more information, go to ramp time.
SEQUENCE Sequence of chaos execution for multiple target pods. Default: parallel. Supports serial and parallel. For more information, go to sequence of chaos execution.
TARGET_CONTAINER Name of the container subject to API header modification. None. For more information, go to target specific container
TARGET_PODS Comma-separated list of application pod names subject to pod HTTP modify body. If not provided, the fault selects target pods randomly based on provided appLabels. For more information, go to target specific pods.
NODE_LABEL Node label used to filter the target node if TARGET_NODE environment variable is not set. It is mutually exclusive with the TARGET_NODE environment variable. If both are provided, the fault uses TARGET_NODE. For more information, go to node label.
LIB_IMAGE Image used to inject chaos. Default: harness/chaos-go-runner:main-latest. For more information, go to image used by the helper pod.

Parameters

The following YAML snippet illustrates the use of these tunables:

apiVersion: litmuschaos.io/v1alpha1
kind: KubernetesChaosExperiment
metadata:
name: pod-jvm-trigger-gc
namespace: hce
env:
- name: TOTAL_CHAOS_DURATION
value: "60"
- name: POD_AFFECTED_PERCENTAGE
value: ""
- name: BYTEMAN_PORT
value: "9091"
- name: JAVA_HOME
value: ""
- name: CONTAINER_RUNTIME
value: containerd
- name: SOCKET_PATH
value: /run/containerd/containerd.sock
- name: LIB_IMAGE
value: docker.io/harness/chaos-ddcr-faults:1.49.2
- name: RAMP_TIME
value: ""
- name: SEQUENCE
value: parallel
- name: TARGET_CONTAINER
value: ""
- name: TARGET_PODS
value: ""
- name: NODE_LABEL
value: ""