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, 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.

External packages

This fault uses stress-ng, which is installed as part of the infrastructure installation.

Fault tunables

Optional tunables

Tunable Description Notes
memory Amount of memory to be consumed. Can be specified in bytes (b/B), kilobytes (k/K), megabytes (m/M), gigabytes (g/G), or percentage (%) of available storage. If no unit is provided, the value is assumed to be in bytes. Example values: 30m, 1G, 35%, etc. Default: 256m
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
memory: 5g

Memory consumption

The memory input variable specifies the amount of memory to be filled.

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

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