Skip to main content

Linux JVM memory stress

Linux JVM memory stress consumes excessive memory resources of the JVM. This sometimes results in OOM kill (Out-of-memory).

tip

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

Linux JVM memory stress

Use cases

Linux 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 application JVM.
  • 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.
note
  • This fault can be executed on Ubuntu 16 or higher, Debian 10 or higher, CentOS 7 or higher, RHEL 7 or higher, Fedora 30 or higher, and openSUSE LEAP 15.4 or higher.
  • The linux-chaos-infrastructure systemd service should be in an active state, and the infrastructure should be in CONNECTED state.

Fault permissions

The fault uses the root Linux user and root user group.

Mandatory tunables

Tunable Description Notes
memory The type of memory to stress. Choose between heap or stack.
pid The process ID that Byteman uses to target the service. This is mutually exclusive with startupCommand. If pid is specified (other than 0), startupCommand is not required. For example, 6429.
startupCommand The command used to start the Java process. A substring match is used with the given command for all processes. This is mutually exclusive with pid. If startupCommand is specified, you need to set pid to 0. For example, /usr/local/bin/pet-clinic.jar.

Optional tunables

Tunable Description Notes
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.
port Port used by the Byteman agent. Default: 9091.
rampTime 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.

Pid

The process ID used by Byteman to target the services of the JVM. This is mutually exclusive with the startupCommand input variable.

The following YAML snippet illustrates the use of this input variable:

apiVersion: litmuchaos.io/v1alpha1
kind: LinuxFault
metadata:
name: linux-jvm-memory-stress
labels:
name: jvm-memory-stress
spec:
jvmChaos/inputs:
duration: 30s
port: 9091
pid: 1
memoryType: "heap"
rampTime: ""

Startup command

The startupCommand is used to start the Java process. A substring match is used with the given command for all processes. This is mutually exclusive with the pid input variable.

The following YAML snippet illustrates the use of this input variable:

apiVersion: litmuchaos.io/v1alpha1
kind: LinuxFault
metadata:
name: linux-jvm-memory-stress
labels:
name: jvm-memory-stress
spec:
jvmChaos/inputs:
duration: 30s
port: 9091
pid: 0
memoryType: "heap"
startupCommand: "/usr/bin/pet-clinic.jar"
rampTime: ""

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:

apiVersion: litmuchaos.io/v1alpha1
kind: LinuxFault
metadata:
name: linux-jvm-memory-stress
labels:
name: jvm-memory-stress
spec:
jvmChaos/inputs:
duration: 30s
port: 9091
pid: 0
memoryType: "heap"
startupCommand: "/usr/bin/pet-clinic.jar"
rampTime: ""