Skip to main content

Linux memory stress

Linux memory stress causes memory consumption of the target Linux machines for a specific duration.

Linux memory stress

Use cases

  • Induces memory consumption and exhaustion on the target Linux machines.
  • 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, 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 tunables

Optional tunables

Tunable Description Notes
memoryBytes Amount of memory consumed (in bytes). Mutually exclusive to memoryPercentage. Default: 256 MB
memoryPercentage Amount of memory consumed (in percentage of the total available memory). Mutually exclusive to memoryBytes.
workers Number of worker processes to start. Default: 1
duration Duration through which chaos is injected into the target resource (in seconds). Default: 30 s
rampTime Period to wait before and after injecting chaos (in seconds). Default: 0 s

Workers

The workers input variable utilizes a specific number of workers for the memory stress fault.

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

# workers to utilize
apiVersion: litmuchaos.io/v1alpha1
kind: LinuxFault
metadata:
name: linux-memory-stress
labels:
name: memory-stress
spec:
stressChaos/inputs:
workers: 1
memoryPercentage: 50

Memory consumption in bytes

The memoryBytes input variable utilizes a specific amount of memory (in bytes).

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

# memory bytes to consume
apiVersion: litmuchaos.io/v1alpha1
kind: LinuxFault
metadata:
name: linux-memory-stress
labels:
name: memory-stress
spec:
stressChaos/inputs:
workers: 1
memoryBytes: 5000

Memory consumption in percentage

The memoryPercentage input variable utilizes a specific amount of memory (in percentage).

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

# memory percentage to consume
apiVersion: litmuchaos.io/v1alpha1
kind: LinuxFault
metadata:
name: linux-memory-stress
labels:
name: memory-stress
spec:
stressChaos/inputs:
workers: 1
memoryPercentage: 70