Pod JVM memory stress
Pod JVM memory stress injects JVM memory stress for a Java process executing in a Kubernetes pod by consuming excessive memory resources of the JVM. This sometimes results in an OOM kill (Out-of-memory).
Use cases
Pod JVM memory stress:
Tests the system's ability to handle high payloads.
Evaluates the application's behavior in high-stress cases.
Induces memory consumption and exhaustion on the target Java process JVM executing in a K8s pod.
Simulates a lack of memory for processes running on the application, which degrades their performance.
Simulates application slowness due to memory starvation, and noisy neighbour problems due to excessive consumption of memory.
Permissions required
Below is a sample Kubernetes role that defines the permissions required to execute the fault.
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
namespace: hce
name: pod-jvm-memory-stress
spec:
definition:
scope: Namespaced
permissions:
- apiGroups: [""]
resources: ["pods"]
verbs: ["create", "delete", "get", "list", "patch", "deletecollection", "update"]
- apiGroups: [""]
resources: ["events"]
verbs: ["create", "get", "list", "patch", "update"]
- apiGroups: [""]
resources: ["pods/log"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["deployments", "statefulsets"]
verbs: ["get", "list"]
- apiGroups: ["batch"]
resources: ["jobs"]
verbs: ["create", "delete", "get", "list", "deletecollection"]Supported environments
GKE (Google Kubernetes Engine)
✅ Supported
EKS (Amazon Elastic Kubernetes Service)
✅ Supported
AKS (Azure Kubernetes Service)
✅ Supported
GKE Autopilot
✅ Supported
Self-managed Kubernetes
✅ Supported
Optional tunables
MEMORY_TYPE
The type of JVM memory region to stress.
Default: heap. Choose between heap and stack.
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_PERCENTAGE
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 target container subject to chaos.
None. For more information, go to target specific container
TARGET_PODS
Comma-separated list of application pod names subject to pod JVM memory stress.
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.
Memory type
The type of memory that is consumed in excess by the JVM; choose between heap and stack memory.
The following YAML snippet illustrates the use of this input variable.
Parameters
The following YAML snippet illustrates the use of these tunables.
Last updated
Was this helpful?